Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2001-11-17 23:19:19 +0300
committerChristopher Faylor <me@cgf.cx>2001-11-17 23:19:19 +0300
commit9c6a5c6ea84b1ac29aa6115264d46ed9621c8317 (patch)
tree00793e7d15b9b5f8da1ac68b0c34324b9a9fc415
parent33f0f67db7ec201294f579e789264cdd302bef7f (diff)
* path.cc (conv_path_list): Copy source paths before modifying them.
-rw-r--r--winsup/cygwin/ChangeLog4
-rw-r--r--winsup/cygwin/path.cc11
2 files changed, 12 insertions, 3 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 3f199f918..ebf7b32cd 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,7 @@
+2001-11-17 Nick Duffek <nick@duffek.com>
+
+ * path.cc (conv_path_list): Copy source paths before modifying them.
+
2001-11-17 Corinna Vinschen <corinna@vinschen.de>
* fhandler_raw.cc (fhandler_dev_raw::clear): Don't reset unit.
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index 41ea4d4ec..f724a47e6 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -1234,17 +1234,22 @@ conv_path_list (const char *src, char *dst, int to_posix_p)
int (*conv_fn) (const char *, char *) = (to_posix_p
? cygwin_conv_to_posix_path
: cygwin_conv_to_win32_path);
+ char srcbuf[MAX_PATH];
+ int len;
do
{
s = strchr (src, src_delim);
if (s)
{
- *s = 0;
- (*conv_fn) (src[0] != 0 ? src : ".", d);
+ len = s - src;
+ if (len >= MAX_PATH)
+ len = MAX_PATH - 1;
+ memcpy (srcbuf, src, len);
+ srcbuf[len] = 0;
+ (*conv_fn) (len ? srcbuf : ".", d);
d += strlen (d);
*d++ = dst_delim;
- *s = src_delim;
src = s + 1;
}
else