summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--winsup/cygwin/path.cc21
-rw-r--r--winsup/cygwin/release/2.11.113
2 files changed, 29 insertions, 5 deletions
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index 6d8f76db5..3cb46c9c8 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -1394,14 +1394,27 @@ normalize_win32_path (const char *src, char *dst, char *&tail)
}
else if (*src != '/')
{
+ /* Make sure dst points to the rightmost backslash which must not
+ be backtracked over during ".." evaluation. This is either
+ the backslash after the network path prefix (i.e. "\\") or
+ the backslash after a drive letter (i.e. C:\"). */
if (beg_src_slash)
- dst = (tail += cygheap->cwd.get_drive (dst));
+ {
+ tail += cygheap->cwd.get_drive (dst);
+ /* network path, drive == '\\\\'? Decrement tail to avoid
+ triple backslash in output. */
+ if (dst[0] == '\\')
+ --tail;
+ dst = tail;
+ }
else if (cygheap->cwd.get (dst, 0))
{
tail = strchr (tail, '\0');
if (tail[-1] != '\\')
*tail++ = '\\';
- dst = tail - 1;
+ ++dst;
+ if (dst[1] == '\\')
+ ++dst;
}
else
return get_errno ();
@@ -1428,9 +1441,7 @@ normalize_win32_path (const char *src, char *dst, char *&tail)
}
/* Backup if "..". */
- else if (src[0] == '.' && src[1] == '.'
- /* dst must be greater than dst_start */
- && tail[-1] == '\\')
+ else if (src[0] == '.' && src[1] == '.' && tail[-1] == '\\')
{
if (!isdirsep (src[2]) && src[2] != '\0')
*tail++ = *src++;
diff --git a/winsup/cygwin/release/2.11.1 b/winsup/cygwin/release/2.11.1
new file mode 100644
index 000000000..c7dfb14c4
--- /dev/null
+++ b/winsup/cygwin/release/2.11.1
@@ -0,0 +1,13 @@
+What's new:
+-----------
+
+
+What changed:
+-------------
+
+
+Bug Fixes
+---------
+
+- Fix ".." handling in Win32 path normalization, introduced in 2.11.0.
+ Addresses: https://cygwin.com/ml/cygwin/2018-09/msg00000.html