zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: minor bug with f glob qualifier
@ 2003-08-01 11:56 Oliver Kiddle
  0 siblings, 0 replies; only message in thread
From: Oliver Kiddle @ 2003-08-01 11:56 UTC (permalink / raw)
  To: Zsh workers

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;


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-08-01 15:57 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-08-01 11:56 PATCH: minor bug with f glob qualifier Oliver Kiddle

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).