This is the mail archive of the cygwin-patches@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: win95 and pshared mutex support for pthreads


On Tue, Apr 24, 2001 at 11:22:02PM +0200, Corinna Vinschen wrote:
> Chris, I assume that it's not a showstopper but I will patch
> it for 1.3.2.  My upcoming changes to the security code will
> need reentrant getpwxxx and getgrxxx functions.


OOOPS! Wait, the getpwuid_r and getpwnam_r can't work!

Look at that code:

  size_t needsize = strlen (temppw->pw_name) + strlen (temppw->pw_dir) + strlen (temppw->pw_shell);

What about the \0 bytes?

  size_t needsize = strlen (temppw->pw_name) + strlen (temppw->pw_dir) + strlen (temppw->pw_shell) + 3;

  pwd->pw_name = buffer;
  pwd->pw_dir = buffer + strlen (temppw->pw_name);

Shouldn't that be 

  pwd->pw_dir = buffer + strlen (temppw->pw_name) + 1

?

  pwd->pw_shell = buffer + strlen (temppw->pw_name) + strlen (temppw->pw_dir);

and that one

  pwd->pw_shell = pwd->pw_dir + strlen (temppw->pw_dir) + 1;

?

Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Developer                                mailto:cygwin@cygwin.com
Red Hat, Inc.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]