* cygpath.cc (do_pathconv): Fix potential crash.

This commit is contained in:
Corinna Vinschen 2010-02-13 11:41:53 +00:00
parent cfdf224b82
commit 03ac74c168
2 changed files with 8 additions and 6 deletions

View File

@ -1,3 +1,7 @@
2010-02-13 Ilguiz Latypov <ilatypov@infradead.org>
* cygpath.cc (do_pathconv): Fix potential crash.
2010-02-11 Corinna Vinschen <corinna@vinschen.de> 2010-02-11 Corinna Vinschen <corinna@vinschen.de>
* getlocale.c (main): Rename local variable to avoid problems. * getlocale.c (main): Rename local variable to avoid problems.

View File

@ -772,8 +772,6 @@ do_pathconv (char *filename)
buf = get_long_name (tmp = buf, len); buf = get_long_name (tmp = buf, len);
free (tmp); free (tmp);
} }
/* buf gets moved into the array so we have to set tmp for later
freeing beforehand. */
tmp = buf; tmp = buf;
if (strncmp (buf, "\\\\?\\", 4) == 0) if (strncmp (buf, "\\\\?\\", 4) == 0)
{ {
@ -782,13 +780,13 @@ do_pathconv (char *filename)
len = 6; len = 6;
if (strlen (buf) < MAX_PATH + len) if (strlen (buf) < MAX_PATH + len)
{ {
buf += len; tmp += len;
if (len == 6) if (len == 6)
*buf = '\\'; *tmp = '\\';
} }
} }
if (mixed_flag) if (mixed_flag)
convert_slashes (buf); convert_slashes (tmp);
} }
} }
@ -796,7 +794,7 @@ do_pathconv (char *filename)
if (buf2) if (buf2)
free (buf2); free (buf2);
if (buf) if (buf)
free (tmp); free (buf);
} }
static void static void