summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNorihiro Tanaka <noritnk@kcn.ne.jp>2014-10-03 07:53:06 +0900
committerPaul Eggert <eggert@cs.ucla.edu>2014-10-04 09:37:00 -0700
commit4a9a21121c9156077a77a8587f8c43f8b940d259 (patch)
tree1ee2ce37e9b840a25e005c9371bbb8e79974e484
parent054fed46cbaf92349a9691592d8a8d211c0cc1be (diff)
downloadgrep-4a9a21121c9156077a77a8587f8c43f8b940d259.tar.gz
grep: fix subscript error when testing whether empty lines match
src/grep.c (grep): When testing whether an empty line matches, make the input buffer one byte longer, as dfaexec uses that for a sentinel.
-rw-r--r--src/grep.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/grep.c b/src/grep.c
index bb5ba1c4..7475ea16 100644
--- a/src/grep.c
+++ b/src/grep.c
@@ -2513,8 +2513,9 @@ main (int argc, char **argv)
compile (keys, keycc);
free (keys);
+ char eolbytes[2] = { eolbyte };
size_t match_size;
- skip_empty_lines = ((execute (&eolbyte, 1, &match_size, NULL) == 0)
+ skip_empty_lines = ((execute (eolbytes, 1, &match_size, NULL) == 0)
== out_invert);
if ((argc - optind > 1 && !no_filenames) || with_filenames)