summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4b15522)
raw | patch | inline | side by side (parent: 4b15522)
author | Brian Gernhardt <benji@silverinsanity.com> | |
Fri, 22 Dec 2006 13:56:25 +0000 (08:56 -0500) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Sat, 23 Dec 2006 07:17:20 +0000 (23:17 -0800) |
The option checking code for --git-dir had an off by 1 error that
would cause it to access uninitialized memory if it was the last
argument. This causes it to display an error and display the usage
string instead.
Signed-off-by: Brian Gernhardt <benji@silverinsanity.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
would cause it to access uninitialized memory if it was the last
argument. This causes it to display an error and display the usage
string instead.
Signed-off-by: Brian Gernhardt <benji@silverinsanity.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
git.c | patch | blob | history |
index 73cf4d4e019c2c0169e6181b2c557cdeb3f962e7..7bb61d8375e5f4c3fe3f5b7dfa85d7f1f3fff997 100644 (file)
--- a/git.c
+++ b/git.c
} else if (!strcmp(cmd, "-p") || !strcmp(cmd, "--paginate")) {
setup_pager();
} else if (!strcmp(cmd, "--git-dir")) {
- if (*argc < 1)
- return -1;
+ if (*argc < 2) {
+ fprintf(stderr, "No directory given for --git-dir.\n" );
+ usage(git_usage_string);
+ }
setenv("GIT_DIR", (*argv)[1], 1);
(*argv)++;
(*argc)--;