Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: minor bug with f glob qualifier



An empty spec component for the f glob qualifier could cause an
infinite loop in the code. e.g. ls *(f:,755:)

This patch fixes that by making it print an error instead.

Oliver

Index: Src/glob.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/glob.c,v
retrieving revision 1.29
diff -u -r1.29 glob.c
--- Src/glob.c	20 Feb 2003 08:17:48 -0000	1.29
+++ Src/glob.c	1 Aug 2003 11:49:38 -0000
@@ -814,7 +814,7 @@
 	    }
 	    if (how == '=' || how == '-')
 		no |= val & mask;
-	} else {
+	} else if (!(end && c == end) && c != ',' && c) {
 	    t = 07777;
 	    while ((c = *p) == '?' || c == Quest ||
 		   (c >= '0' && c <= '7')) {
@@ -838,7 +838,10 @@
 		yes |= val;
 	    else
 		no |= val;
-	}
+	} else {
+	    zerr("invalid mode specification", NULL, 0);
+	    return 0;
+        }
     } while (end && c != end);
 
     *s = p;



Messages sorted by: Reverse Date, Date, Thread, Author