diff options
author | ache <ache@FreeBSD.org> | 2016-09-06 00:33:54 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 2016-09-06 00:33:54 +0000 |
commit | 604d056da8a45b89edd33e364751e5ad2e2e26cd (patch) | |
tree | 2a5f656c20b7c0cc9351216616ab09ae17901fa7 | |
parent | 852a8b050b91974586de9d220bb8c9d9ba5199fb (diff) | |
download | FreeBSD-src-604d056da8a45b89edd33e364751e5ad2e2e26cd.zip FreeBSD-src-604d056da8a45b89edd33e364751e5ad2e2e26cd.tar.gz |
MFC r305365
The bug:
$ echo x | awk '/[[:cntrl:]]/'
x
The NUL character in cntrl class truncates the pattern, and an empty
pattern matches anything. The patch skips NUL as a quick fix.
PR: 195792
Submitted by: kdrakehp@zoho.com
Approved by: bwk@cs.princeton.edu (the author)
-rw-r--r-- | contrib/one-true-awk/b.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/contrib/one-true-awk/b.c b/contrib/one-true-awk/b.c index 01b91f3..96ecdd2 100644 --- a/contrib/one-true-awk/b.c +++ b/contrib/one-true-awk/b.c @@ -841,7 +841,7 @@ int relex(void) /* lexical analyzer for reparse */ if (cc->cc_name != NULL && prestr[1 + cc->cc_namelen] == ':' && prestr[2 + cc->cc_namelen] == ']') { prestr += cc->cc_namelen + 3; - for (i = 0; i < NCHARS; i++) { + for (i = 1; i < NCHARS; i++) { if (!adjbuf((char **) &buf, &bufsz, bp-buf+1, 100, (char **) &bp, "relex2")) FATAL("out of space for reg expr %.10s...", lastre); if (cc->cc_func(i)) { |