From 9c6a5c6ea84b1ac29aa6115264d46ed9621c8317 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Sat, 17 Nov 2001 20:19:19 +0000 Subject: [PATCH] * path.cc (conv_path_list): Copy source paths before modifying them. --- winsup/cygwin/ChangeLog | 4 ++++ 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 + + * path.cc (conv_path_list): Copy source paths before modifying them. + 2001-11-17 Corinna Vinschen * 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 -- 2.43.5