about summary refs log tree commit diff
path: root/Src/utils.c
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2009-09-30 20:32:18 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2009-09-30 20:32:18 +0000
commit500431077b5a8e9ba1af3e2cb87bae5d4701c799 (patch)
tree493c1e7dda2cbdaf12f31e08190b3506cce95ec5 /Src/utils.c
parent8c4c4660bf7ed39742a2f8ee2887738cb3efcc63 (diff)
downloadzsh-500431077b5a8e9ba1af3e2cb87bae5d4701c799.tar.gz
zsh-500431077b5a8e9ba1af3e2cb87bae5d4701c799.tar.xz
zsh-500431077b5a8e9ba1af3e2cb87bae5d4701c799.zip
Apple opensource patches suggested by Jun T. in 27300
Diffstat (limited to 'Src/utils.c')
-rw-r--r--Src/utils.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Src/utils.c b/Src/utils.c
index b807eea08..230951ffc 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -3427,8 +3427,11 @@ spname(char *oldname)
      * otherwise a copy of oldname with a corrected prefix is returned.  *
      * Rationale for this, if there ever was any, has been forgotten.    */
     for (;;) {
-	while (*old == '/')
+	while (*old == '/') {
+	    if ((new - newname) >= (sizeof(newname)-1))
+		return NULL;
 	    *new++ = *old++;
+	}
 	*new = '\0';
 	if (*old == '\0')
 	    return newname;