Skip to content

Commit 7d0dafe

Browse files
committed
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
2 parents b9cb077 + 34f3999 commit 7d0dafe

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

builtin-grep.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ static int grep_file(struct grep_opt *opt, const char *filename)
205205
return 0;
206206
}
207207
close(i);
208+
data[sz] = 0;
208209
if (opt->relative && opt->prefix_length)
209210
filename = quote_path_relative(filename, -1, &buf, opt->prefix);
210211
i = grep_buffer(opt, filename, data, sz);

0 commit comments

Comments
 (0)