about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <p.w.stephenson@ntlworld.com>2015-01-04 19:42:45 +0000
committerPeter Stephenson <p.w.stephenson@ntlworld.com>2015-01-04 19:42:45 +0000
commit98f465c09f6edc56e8332de42fddee9b689b2ed6 (patch)
treeb430a733b3c042d3829ba6e6ba819b5b0cf48f36
parentf9cba834cdcd5f35d21768b6412577236adc5ed2 (diff)
downloadzsh-98f465c09f6edc56e8332de42fddee9b689b2ed6.tar.gz
zsh-98f465c09f6edc56e8332de42fddee9b689b2ed6.tar.xz
zsh-98f465c09f6edc56e8332de42fddee9b689b2ed6.zip
34092: fix miscount of symlink resolution for "..".
This caused problems with expanding a path with ".." in "whence -S".
-rw-r--r--ChangeLog3
-rw-r--r--Src/utils.c2
2 files changed, 5 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index ca5d401ab..d1b385f86 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2015-01-04  Peter Stephenson  <p.w.stephenson@ntlworld.com>
 
+	* 34092: Src/utils.c: miscount of buffer length in symlink
+	resolution after ".." caused error with whence -S.
+
 	* 34091: Src/utils.c: typo with "whence -s" expansions.
 
 	* users/19682: Doc/Zsh/builtins.yo: document recommended use of
diff --git a/Src/utils.c b/Src/utils.c
index 959df9ab7..390f513ba 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -741,6 +741,8 @@ xsymlinks(char *s, int full)
 	    while (*--p != '/')
 		xbuflen--;
 	    *p = '\0';
+	    /* The \0 isn't included in the length */
+	    xbuflen--;
 	    continue;
 	}
 	sprintf(xbuf2, "%s/%s", xbuf, *pp);