utils.c.patch   [plain text]


diff -up -r /SourceCache/zsh/zsh-51/zsh/Src/utils.c ./Src/utils.c
--- /SourceCache/zsh/zsh-51/zsh/Src/utils.c	2008-03-14 06:09:13.000000000 -0700
+++ ./Src/utils.c	2008-11-13 17:09:24.000000000 -0800
@@ -3244,8 +3244,10 @@ 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;