Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
To: Eric Blake <ebb9@byu.net>
Cc: "Pierre A. Humblet" <Pierre.Humblet@ieee.org>, cygwin@cygwin.com,
   bug-coreutils@gnu.org
Subject: Re: mkdir -p and network drives
References: <3.0.5.32.20050502232204.00b52180@incoming.verizon.net> <42777719.8090103@byu.net> <8764xym6vf.fsf@penguin.cs.ucla.edu> <427AD935.1010409@byu.net>
From: Paul Eggert <eggert@CS.UCLA.EDU>
Date: Thu, 05 May 2005 20:47:00 -0700
In-Reply-To: <427AD935.1010409@byu.net> (Eric Blake's message of "Thu, 05 May 2005 20:40:53 -0600")
Message-ID: <87vf5x818r.fsf@penguin.cs.ucla.edu>
User-Agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.4 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii

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/

