Date: Wed, 27 Jun 2001 19:10:02 -0700 (PDT) From: Tor.Egge@fast.no To: freebsd-bugs@FreeBSD.org Subject: Re: bin/28449: sh(1) aborts on certain input Message-ID: <200106280210.f5S2A2G18011@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/28449; it has been noted by GNATS.
From: Tor.Egge@fast.no
To: ru@FreeBSD.ORG
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: bin/28449: sh(1) aborts on certain input
Date: Thu, 28 Jun 2001 04:07:07 +0200
Try this patch.
Index: expand.c
===================================================================
RCS file: /home/ncvs/src/bin/sh/expand.c,v
retrieving revision 1.32
diff -u -r1.32 expand.c
--- expand.c 2000/05/15 12:33:17 1.32
+++ expand.c 2001/03/04 23:52:35
@@ -315,7 +315,7 @@
goto lose;
*p = c;
while ((c = *home++) != '\0') {
- if (quotes && c >= 0 && SQSYNTAX[(int)c] == CCTL)
+ if (quotes && SQSYNTAX[(int)c] == CCTL)
STPUTC(CTLESC, expdest);
STPUTC(c, expdest);
}
@@ -478,7 +478,7 @@
}
lastc = *p++;
if (lastc != '\0') {
- if (quotes && lastc >= 0 && syntax[(int)lastc] == CCTL)
+ if (quotes && syntax[(int)lastc] == CCTL)
STPUTC(CTLESC, dest);
STPUTC(lastc, dest);
}
@@ -694,7 +694,7 @@
}
else {
while (*val) {
- if (quotes && *val >= 0 &&
+ if (quotes &&
syntax[(int)*val] == CCTL)
STPUTC(CTLESC, expdest);
STPUTC(*val++, expdest);
@@ -866,7 +866,7 @@
if (allow_split) { \
syntax = quoted? DQSYNTAX : BASESYNTAX; \
while (*p) { \
- if (*p >= 0 && syntax[(int)*p] == CCTL) \
+ if (syntax[(int)*p] == CCTL) \
STPUTC(CTLESC, expdest); \
STPUTC(*p++, expdest); \
} \
Index: mksyntax.c
===================================================================
RCS file: /home/ncvs/src/bin/sh/mksyntax.c,v
retrieving revision 1.15
diff -u -r1.15 mksyntax.c
--- mksyntax.c 2001/06/19 15:41:57 1.15
+++ mksyntax.c 2001/06/21 21:54:20
@@ -352,9 +352,9 @@
static char *macro[] = {
"#define is_digit(c)\t((c >= 0 && is_type+SYNBASE)[c] & ISDIGIT)",
- "#define is_alpha(c)\t((c) != PEOF && ((c) < CTLESC || (c) > CTLENDARI) && isalpha((unsigned char) (c)))",
- "#define is_name(c)\t((c) != PEOF && ((c) < CTLESC || (c) > CTLENDARI) && ((c) == '_' || isalpha((unsigned char) (c))))",
- "#define is_in_name(c)\t((c) != PEOF && ((c) < CTLESC || (c) > CTLENDARI) && ((c) == '_' || isalnum((unsigned char) (c))))",
+ "#define is_alpha(c)\t((c) != PEOF && ((c) < CTLESC || (c) > CTLQUOTEMARK) && isalpha((unsigned char) (c)))",
+ "#define is_name(c)\t((c) != PEOF && ((c) < CTLESC || (c) > CTLQUOTEMARK) && ((c) == '_' || isalpha((unsigned char) (c))))",
+ "#define is_in_name(c)\t((c) != PEOF && ((c) < CTLESC || (c) > CTLQUOTEMARK) && ((c) == '_' || isalnum((unsigned char) (c))))",
"#define is_special(c)\t((is_type+SYNBASE)[c] & (ISSPECL|ISDIGIT))",
NULL
};
Index: parser.c
===================================================================
RCS file: /home/ncvs/src/bin/sh/parser.c,v
retrieving revision 1.36
diff -u -r1.36 parser.c
--- parser.c 2001/04/09 12:46:19 1.36
+++ parser.c 2001/04/17 18:27:52
@@ -977,7 +977,7 @@
c != '`' && c != '$' &&
(c != '"' || eofmark != NULL))
USTPUTC('\\', out);
- if (c >= 0 && SQSYNTAX[c] == CCTL)
+ if (SQSYNTAX[c] == CCTL)
USTPUTC(CTLESC, out);
else if (eofmark == NULL)
USTPUTC(CTLQUOTEMARK, out);
@@ -1496,7 +1496,7 @@
continue;
if (c == CTLESC)
p++;
- else if (c >= 0 && BASESYNTAX[(int)c] == CCTL)
+ else if (BASESYNTAX[(int)c] == CCTL)
return 0;
}
return 1;
- Tor Egge
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200106280210.f5S2A2G18011>
