This is the mail archive of the cygwin 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]
Other format: [Raw text]

Re: mkdir -p and network drives


Eric Blake <ebb9@byu.net> writes:

>> +      if (do_chdir && dirpath[0] == '/')
>> +	{
>> +	  /* POSIX says "//" might be special, so chdir to "//" if the
>> +	     file name starts with exactly two slashes.  */
>> +	  char const *root = "//" + (dirpath[1] != '/' || dirpath[2] == '/');
>
> Oops - buffer overflow bug.  dirpath[2] is past the end of the string on
> dirpath of "/",

If dirpath is "/", then dirpath[1] != '/' is true, so dirpath[2] isn't
evaluated.

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


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