From mboxrd@z Thu Jan 1 00:00:00 1970 From: normalperson at yhbt.net (Eric Wong) Date: Sun, 22 Jan 2017 22:30:30 +0000 Subject: [PATCH] ui-patch: fix segfault when a path prefix is passed Message-ID: <20170122223030.GA5886@starla> From: Eric Wong pathspec.c::parse_pathspec in git assumes the `argv' array is terminated with a NULL entry, so do not let it iterate past the end of the array. Signed-off-by: Eric Wong --- ui-patch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui-patch.c b/ui-patch.c index ec7f352..53475f7 100644 --- a/ui-patch.c +++ b/ui-patch.c @@ -18,7 +18,7 @@ void cgit_print_patch(const char *new_rev, const char *old_rev, struct commit *commit; struct object_id new_rev_oid, old_rev_oid; char rev_range[2 * 40 + 3]; - const char *rev_argv[] = { NULL, "--reverse", "--format=email", rev_range, "--", prefix }; + const char *rev_argv[] = { NULL, "--reverse", "--format=email", rev_range, "--", prefix, NULL }; int rev_argc = ARRAY_SIZE(rev_argv); char *patchname; -- EW