summaryrefslogtreecommitdiff
path: root/builtin-grep.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2010-01-18 17:03:34 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2010-01-18 17:03:34 -0800
commit7d0dafe3945408aeef9c2e5256ac926976170e54 (patch)
tree01187d82cec0dfc4d72bbcf42a35abb4a27ca6ed /builtin-grep.c
parentFix uninitialized variable in get_refs_via_rsync(). (diff)
parentgrep: NUL terminate input from a file (diff)
downloadtgif-7d0dafe3945408aeef9c2e5256ac926976170e54.tar.xz
Merge branch 'jm/maint-1.6.5-grep-NUL-terminate' into maint
* jm/maint-1.6.5-grep-NUL-terminate: grep: NUL terminate input from a file
Diffstat (limited to 'builtin-grep.c')
-rw-r--r--builtin-grep.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/builtin-grep.c b/builtin-grep.c
index af6c6fe8a7..c7d74fbb7f 100644
--- a/builtin-grep.c
+++ b/builtin-grep.c
@@ -205,6 +205,7 @@ static int grep_file(struct grep_opt *opt, const char *filename)
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);