diff options
author | Christopher Faylor <me@cgf.cx> | 2001-11-17 23:19:19 +0300 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2001-11-17 23:19:19 +0300 |
commit | 9c6a5c6ea84b1ac29aa6115264d46ed9621c8317 (patch) | |
tree | 00793e7d15b9b5f8da1ac68b0c34324b9a9fc415 /winsup | |
parent | 33f0f67db7ec201294f579e789264cdd302bef7f (diff) |
* path.cc (conv_path_list): Copy source paths before modifying them.
Diffstat (limited to 'winsup')
-rw-r--r-- | winsup/cygwin/ChangeLog | 4 | ||||
-rw-r--r-- | winsup/cygwin/path.cc | 11 |
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 |