Skip to content

Commit

Permalink
repo-config: fix segfault with no argument.
Browse files Browse the repository at this point in the history
An earlier addition of --list feature was carelessly done and
caused an invalid access to argv[1] when it was not given.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
  • Loading branch information
Johannes Schindelin authored and Junio C Hamano committed May 2, 2006
1 parent 746437d commit cfa24e1
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions repo-config.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,14 @@ int main(int argc, const char **argv)
type = T_INT;
else if (!strcmp(argv[1], "--bool"))
type = T_BOOL;
else if (!strcmp(argv[1], "--list") || !strcmp(argv[1], "-l"))
return git_config(show_all_config);
else
break;
argc--;
argv++;
}

if (!strcmp(argv[1], "--list") || !strcmp(argv[1], "-l"))
return git_config(show_all_config);

switch (argc) {
case 2:
return get_value(argv[1], NULL);
Expand Down

0 comments on commit cfa24e1

Please sign in to comment.