summaryrefslogtreecommitdiff
path: root/http-push.c
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2009-05-21 19:32:44 +1000
committerJunio C Hamano <gitster@pobox.com>2009-05-21 08:56:24 -0700
commita80aad7b85fc560451e07792d64ab6cb15a39914 (patch)
treeed917349c318912c25f5653260f4dc970287f099 /http-push.c
parent06f391906a69e410c9a6ca5e13774529a091385d (diff)
downloadgit-a80aad7b85fc560451e07792d64ab6cb15a39914.tar.gz
Terminate argv with NULL before calling setup_revisions()
It is convention that argv should be terminated with NULL, even if argc is used to specify the size of argv. setup_revisions() requires this and may segfault otherwise. This patch makes sure that all argv (that I can find) is NULL terminated. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'http-push.c')
-rw-r--r--http-push.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/http-push.c b/http-push.c
index 29e8ebfebb..dac2c6e052 100644
--- a/http-push.c
+++ b/http-push.c
@@ -2326,7 +2326,7 @@ int main(int argc, char **argv)
new_refs = 0;
for (ref = remote_refs; ref; ref = ref->next) {
char old_hex[60], *new_hex;
- const char *commit_argv[4];
+ const char *commit_argv[5];
int commit_argc;
char *new_sha1_hex, *old_sha1_hex;
@@ -2406,6 +2406,7 @@ int main(int argc, char **argv)
commit_argv[3] = old_sha1_hex;
commit_argc++;
}
+ commit_argv[commit_argc] = NULL;
init_revisions(&revs, setup_git_directory());
setup_revisions(commit_argc, commit_argv, &revs, NULL);
revs.edge_hint = 0; /* just in case */