DORMANTno replies

[PATCH] guard config parser from value=NULL

From: Martin Koegler <hidden>
Date: 2016-06-15 22:44:12
Subsystem: the rest · Maintainer: Linus Torvalds

Signed-off-by: Martin Koegler <redacted>
---
 config.c |   10 +++++-----
 setup.c  |    2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/config.c b/config.c
index 658a11c..b2ea263 100644
--- a/config.c
+++ b/config.c
@@ -416,7 +416,7 @@ int git_default_config(const char *var, const char *value)
 		return 0;
 	}
 
-	if (!strcmp(var, "user.name")) {
+	if (value && !strcmp(var, "user.name")) {
 		strlcpy(git_default_name, value, sizeof(git_default_name));
 		return 0;
 	}
@@ -426,12 +426,12 @@ int git_default_config(const char *var, const char *value)
 		return 0;
 	}
 
-	if (!strcmp(var, "i18n.commitencoding")) {
+	if (value && !strcmp(var, "i18n.commitencoding")) {
 		git_commit_encoding = xstrdup(value);
 		return 0;
 	}
 
-	if (!strcmp(var, "i18n.logoutputencoding")) {
+	if (value && !strcmp(var, "i18n.logoutputencoding")) {
 		git_log_output_encoding = xstrdup(value);
 		return 0;
 	}
@@ -442,12 +442,12 @@ int git_default_config(const char *var, const char *value)
 		return 0;
 	}
 
-	if (!strcmp(var, "core.pager")) {
+	if (value && !strcmp(var, "core.pager")) {
 		pager_program = xstrdup(value);
 		return 0;
 	}
 
-	if (!strcmp(var, "core.editor")) {
+	if (value && !strcmp(var, "core.editor")) {
 		editor_program = xstrdup(value);
 		return 0;
 	}
diff --git a/setup.c b/setup.c
index 23c9a11..8d792dc 100644
--- a/setup.c
+++ b/setup.c
@@ -445,7 +445,7 @@ int check_repository_format_version(const char *var, const char *value)
 		is_bare_repository_cfg = git_config_bool(var, value);
 		if (is_bare_repository_cfg == 1)
 			inside_work_tree = -1;
-	} else if (strcmp(var, "core.worktree") == 0) {
+	} else if (value && strcmp(var, "core.worktree") == 0) {
 		if (git_work_tree_cfg)
 			free(git_work_tree_cfg);
 		git_work_tree_cfg = xstrdup(value);
-- 
1.5.4.gbd71f
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help