Author: kevans
Date: Wed Aug 16 00:42:51 2017
New Revision: 322559
URL: https://svnweb.freebsd.org/changeset/base/322559

Log:
  MFC r316542: bsdgrep: Handle special case of single-byte NUL pattern
  
  PR:           202022
  Approved by:  emaste (mentor, blanket MFC)

Modified:
  stable/11/usr.bin/grep/grep.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.bin/grep/grep.c
==============================================================================
--- stable/11/usr.bin/grep/grep.c       Wed Aug 16 00:40:13 2017        
(r322558)
+++ stable/11/usr.bin/grep/grep.c       Wed Aug 16 00:42:51 2017        
(r322559)
@@ -315,8 +315,12 @@ read_patterns(const char *fn)
        }
        len = 0;
        line = NULL;
-       while ((rlen = getline(&line, &len, f)) != -1)
+       while ((rlen = getline(&line, &len, f)) != -1) {
+               if (line[0] == '\0')
+                       continue;
                add_pattern(line, line[0] == '\n' ? 0 : (size_t)rlen);
+       }
+
        free(line);
        if (ferror(f))
                err(2, "%s", fn);
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to