svn commit: r305450 - stable/9/contrib/one-true-awk

Andrey A. Chernov ache at FreeBSD.org
Tue Sep 6 00:53:22 UTC 2016


Author: ache
Date: Tue Sep  6 00:53:20 2016
New Revision: 305450
URL: https://svnweb.freebsd.org/changeset/base/305450

Log:
  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 at zoho.com
  Approved by:    bwk at cs.princeton.edu (the author)

Modified:
  stable/9/contrib/one-true-awk/b.c
Directory Properties:
  stable/9/   (props changed)
  stable/9/contrib/   (props changed)
  stable/9/contrib/one-true-awk/   (props changed)

Modified: stable/9/contrib/one-true-awk/b.c
==============================================================================
--- stable/9/contrib/one-true-awk/b.c	Tue Sep  6 00:51:25 2016	(r305449)
+++ stable/9/contrib/one-true-awk/b.c	Tue Sep  6 00:53:20 2016	(r305450)
@@ -841,7 +841,7 @@ int relex(void)		/* lexical analyzer for
 				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)) {


More information about the svn-src-stable-9 mailing list