diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2010-02-13 11:41:53 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2010-02-13 11:41:53 +0000 |
commit | 03ac74c1686c75614511450541296c74150cb066 (patch) | |
tree | 73d94fea4a360e3eec074673c5e434e0c170d7d9 /winsup/utils/cygpath.cc | |
parent | cfdf224b823f3f249b9cda1a66df9d4adb2e445c (diff) | |
download | cygnal-03ac74c1686c75614511450541296c74150cb066.tar.gz cygnal-03ac74c1686c75614511450541296c74150cb066.tar.bz2 cygnal-03ac74c1686c75614511450541296c74150cb066.zip |
* cygpath.cc (do_pathconv): Fix potential crash.
Diffstat (limited to 'winsup/utils/cygpath.cc')
-rw-r--r-- | winsup/utils/cygpath.cc | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/winsup/utils/cygpath.cc b/winsup/utils/cygpath.cc index 2b9fed419..4dbdaeff0 100644 --- a/winsup/utils/cygpath.cc +++ b/winsup/utils/cygpath.cc @@ -772,8 +772,6 @@ do_pathconv (char *filename) buf = get_long_name (tmp = buf, len); free (tmp); } - /* buf gets moved into the array so we have to set tmp for later - freeing beforehand. */ tmp = buf; if (strncmp (buf, "\\\\?\\", 4) == 0) { @@ -782,13 +780,13 @@ do_pathconv (char *filename) len = 6; if (strlen (buf) < MAX_PATH + len) { - buf += len; + tmp += len; if (len == 6) - *buf = '\\'; + *tmp = '\\'; } } if (mixed_flag) - convert_slashes (buf); + convert_slashes (tmp); } } @@ -796,7 +794,7 @@ do_pathconv (char *filename) if (buf2) free (buf2); if (buf) - free (tmp); + free (buf); } static void |