[PATCH] guard config parser from value=NULL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Martin Koegler <mkoegler@xxxxxxxxxxxxxxxxx>
---
 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

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux