Skip to content

Commit

Permalink
merge-recursive.c: guard config parser from value=NULL
Browse files Browse the repository at this point in the history
merge.default, merge.*.{name,driver} expect a string value

Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
gitster committed Feb 11, 2008
1 parent 111dd25 commit e098368
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions merge-recursive.c
Original file line number Diff line number Diff line change
Expand Up @@ -844,8 +844,9 @@ static int read_merge_config(const char *var, const char *value)
int namelen;

if (!strcmp(var, "merge.default")) {
if (value)
default_ll_merge = strdup(value);
if (!value)
return config_error_nonbool(var);
default_ll_merge = strdup(value);
return 0;
}

Expand Down Expand Up @@ -878,14 +879,14 @@ static int read_merge_config(const char *var, const char *value)

if (!strcmp("name", ep)) {
if (!value)
return error("%s: lacks value", var);
return config_error_nonbool(var);
fn->description = strdup(value);
return 0;
}

if (!strcmp("driver", ep)) {
if (!value)
return error("%s: lacks value", var);
return config_error_nonbool(var);
/*
* merge.<name>.driver specifies the command line:
*
Expand All @@ -908,7 +909,7 @@ static int read_merge_config(const char *var, const char *value)

if (!strcmp("recursive", ep)) {
if (!value)
return error("%s: lacks value", var);
return config_error_nonbool(var);
fn->recursive = strdup(value);
return 0;
}
Expand Down

0 comments on commit e098368

Please sign in to comment.