summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2008-02-11 10:53:56 -0800
committerJunio C Hamano <gitster@pobox.com>2008-02-11 13:11:36 -0800
commit64f30e948be5fb2cd2f65e91c0eab5ab4719c636 (patch)
tree2aa88e4de5a39ab6d274a5eb2baad2a96d740fd2
parenta7269e5cb703083efb084ba19bc703ebc915aa5c (diff)
downloadgit-64f30e948be5fb2cd2f65e91c0eab5ab4719c636.tar.gz
diff.c: guard config parser from value=NULL
diff.external, diff.*.command, diff.color.*, color.diff.* and diff.*.funcname configuration variables expect a string value. Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--diff.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/diff.c b/diff.c
index 5b8afdcb05..4d2e23ae1b 100644
--- a/diff.c
+++ b/diff.c
@@ -158,6 +158,8 @@ int git_diff_ui_config(const char *var, const char *value)
return 0;
}
if (!strcmp(var, "diff.external")) {
+ if (!value)
+ return config_error_nonbool(var);
external_diff_cmd_cfg = xstrdup(value);
return 0;
}
@@ -165,8 +167,11 @@ int git_diff_ui_config(const char *var, const char *value)
const char *ep = strrchr(var, '.');
if (ep != var + 4) {
- if (!strcmp(ep, ".command"))
+ if (!strcmp(ep, ".command")) {
+ if (!value)
+ return config_error_nonbool(var);
return parse_lldiff_command(var, ep, value);
+ }
}
}
@@ -177,6 +182,8 @@ int git_diff_basic_config(const char *var, const char *value)
{
if (!prefixcmp(var, "diff.color.") || !prefixcmp(var, "color.diff.")) {
int slot = parse_diff_color_slot(var, 11);
+ if (!value)
+ return config_error_nonbool(var);
color_parse(value, var, diff_colors[slot]);
return 0;
}
@@ -184,8 +191,11 @@ int git_diff_basic_config(const char *var, const char *value)
if (!prefixcmp(var, "diff.")) {
const char *ep = strrchr(var, '.');
if (ep != var + 4) {
- if (!strcmp(ep, ".funcname"))
+ if (!strcmp(ep, ".funcname")) {
+ if (!value)
+ return config_error_nonbool(var);
return parse_funcname_pattern(var, ep, value);
+ }
}
}