Browse Source

repo-config: fix segfault with no argument.

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>
maint
Johannes Schindelin 19 years ago committed by Junio C Hamano
parent
commit
cfa24e184a
  1. 5
      repo-config.c

5
repo-config.c

@ -102,15 +102,14 @@ int main(int argc, const char **argv)
type = T_INT; type = T_INT;
else if (!strcmp(argv[1], "--bool")) else if (!strcmp(argv[1], "--bool"))
type = T_BOOL; type = T_BOOL;
else if (!strcmp(argv[1], "--list") || !strcmp(argv[1], "-l"))
return git_config(show_all_config);
else else
break; break;
argc--; argc--;
argv++; argv++;
} }


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

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

Loading…
Cancel
Save