Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2008-02-12 00:10:27 +0300
committerJunio C Hamano <gitster@pobox.com>2008-02-12 00:14:25 +0300
commit6c47d0e8f3983cff5bf633cb8e6f7ecfecf48db7 (patch)
tree5eba727129ec66e575a1215c5e3604ab9480db7c
parent90f5c1864caf40ac2a0fef6bc771eab3ecc561b6 (diff)
config.c: guard config parser from value=NULL
user.{name,email}, core.{pager,editor,excludesfile,whitespace} and i18n.{commit,logoutput}encoding all expect string values. Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--config.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/config.c b/config.c
index 03c94a2704..3f4d3b1602 100644
--- a/config.c
+++ b/config.c
@@ -408,21 +408,29 @@ int git_default_config(const char *var, const char *value)
}
if (!strcmp(var, "user.name")) {
+ if (!value)
+ return config_error_nonbool(var);
strlcpy(git_default_name, value, sizeof(git_default_name));
return 0;
}
if (!strcmp(var, "user.email")) {
+ if (!value)
+ return config_error_nonbool(var);
strlcpy(git_default_email, value, sizeof(git_default_email));
return 0;
}
if (!strcmp(var, "i18n.commitencoding")) {
+ if (!value)
+ return config_error_nonbool(var);
git_commit_encoding = xstrdup(value);
return 0;
}
if (!strcmp(var, "i18n.logoutputencoding")) {
+ if (!value)
+ return config_error_nonbool(var);
git_log_output_encoding = xstrdup(value);
return 0;
}
@@ -434,23 +442,29 @@ int git_default_config(const char *var, const char *value)
}
if (!strcmp(var, "core.pager")) {
+ if (!value)
+ return config_error_nonbool(var);
pager_program = xstrdup(value);
return 0;
}
if (!strcmp(var, "core.editor")) {
+ if (!value)
+ return config_error_nonbool(var);
editor_program = xstrdup(value);
return 0;
}
if (!strcmp(var, "core.excludesfile")) {
if (!value)
- die("core.excludesfile without value");
+ return config_error_nonbool(var);
excludes_file = xstrdup(value);
return 0;
}
if (!strcmp(var, "core.whitespace")) {
+ if (!value)
+ return config_error_nonbool(var);
whitespace_rule_cfg = parse_whitespace_rule(value);
return 0;
}