about summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2003-10-06 22:42:35 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2003-10-06 22:42:35 +0000
commitbbc409eefece558f9b24ea6960e15c0c3468422a (patch)
treec301f84bc174daa8a1e661b243062f09919fba14 /Src
parent530bbb503e7dc6b27fa9adb2423220293d2eed14 (diff)
downloadzsh-bbc409eefece558f9b24ea6960e15c0c3468422a.tar.gz
zsh-bbc409eefece558f9b24ea6960e15c0c3468422a.tar.xz
zsh-bbc409eefece558f9b24ea6960e15c0c3468422a.zip
19167: fix NUL at start of BRACE_CCL range.
Diffstat (limited to 'Src')
-rw-r--r--Src/glob.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/Src/glob.c b/Src/glob.c
index 5f38ad188..857afc5fd 100644
--- a/Src/glob.c
+++ b/Src/glob.c
@@ -1867,12 +1867,13 @@ xpandbraces(LinkList list, LinkNode *np)
 	 * set of flags saying whether each character is present; *
 	 * the final list is in lexical order.                    */
 	char ccl[256], *p;
-	unsigned char c1, c2, lastch;
+	unsigned char c1, c2;
 	unsigned int len, pl;
+	int lastch = -1;
 
 	uremnode(list, node);
 	memset(ccl, 0, sizeof(ccl) / sizeof(ccl[0]));
-	for (p = str + 1, lastch = 0; p < str2;) {
+	for (p = str + 1; p < str2;) {
 	    if (itok(c1 = *p++))
 		c1 = ztokens[c1 - STOUC(Pound)];
 	    if ((char) c1 == Meta)
@@ -1881,10 +1882,10 @@ xpandbraces(LinkList list, LinkNode *np)
 		c2 = ztokens[c2 - STOUC(Pound)];
 	    if ((char) c2 == Meta)
 		c2 = 32 ^ p[1];
-	    if (c1 == '-' && lastch && p < str2 && (int)lastch <= (int)c2) {
-		while ((int)lastch < (int)c2)
+	    if (c1 == '-' && lastch >= 0 && p < str2 && lastch <= (int)c2) {
+		while (lastch < (int)c2)
 		    ccl[lastch++] = 1;
-		lastch = 0;
+		lastch = -1;
 	    } else
 		ccl[lastch = c1] = 1;
 	}