summaryrefslogtreecommitdiff
path: root/builtin-grep.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2010-01-19 01:03:34 (GMT)
committerJunio C Hamano <gitster@pobox.com>2010-01-19 01:03:34 (GMT)
commit7d0dafe3945408aeef9c2e5256ac926976170e54 (patch)
tree01187d82cec0dfc4d72bbcf42a35abb4a27ca6ed /builtin-grep.c
parentb9cb07726a7a288244b585939850348f319e5e0c (diff)
parent34f3999206e8ea41b9e4cf48e30ab1149e01d8a5 (diff)
downloadgit-7d0dafe3945408aeef9c2e5256ac926976170e54.zip
git-7d0dafe3945408aeef9c2e5256ac926976170e54.tar.gz
git-7d0dafe3945408aeef9c2e5256ac926976170e54.tar.bz2
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 af6c6fe..c7d74fb 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);