summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 527b9d7)
raw | patch | inline | side by side (parent: 527b9d7)
author | Jim Meyering <jim@meyering.net> | |
Mon, 18 Jan 2010 21:55:07 +0000 (22:55 +0100) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Tue, 19 Jan 2010 01:01:29 +0000 (17:01 -0800) |
Internally "git grep" runs regexec(3) that expects its input string
to be NUL terminated. When searching inside blob data, read_sha1_file()
automatically gives such a buffer, but builtin-grep.c forgot to put
the NUL at the end, even though it allocated enough space for it.
Signed-off-by: Jim Meyering <meyering@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
to be NUL terminated. When searching inside blob data, read_sha1_file()
automatically gives such a buffer, but builtin-grep.c forgot to put
the NUL at the end, even though it allocated enough space for it.
Signed-off-by: Jim Meyering <meyering@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-grep.c | patch | blob | history |
diff --git a/builtin-grep.c b/builtin-grep.c
index d79a6260a4b6f9a467356de117e100cd1a457b23..63dc31c45c309c7a2a67977e5631cb5334b32ecf 100644 (file)
--- a/builtin-grep.c
+++ b/builtin-grep.c
return 0;
}
close(i);
+ data[sz] = 0;
if (opt->relative && opt->prefix_length)
filename = quote_path_relative(filename, -1, &buf, opt->prefix);
i = grep_buffer(opt, filename, data, sz);