summaryrefslogtreecommitdiff
path: root/submodule.c
diff options
context:
space:
mode:
authorJharrod LaFon <jlafon@eyesopen.com>2013-08-19 09:26:56 -0700
committerJunio C Hamano <gitster@pobox.com>2013-08-19 13:47:56 -0700
commit4b05440283350ec3b01afabe847d9ce5cf4cbdb7 (patch)
treed07d7b4e2fcbfa3d9cb18df7e5110bcfbfc50ff4 /submodule.c
parentf59bebb78edb26e4f66c2754bc4d168c5d4ebb4a (diff)
downloadgit-4b05440283350ec3b01afabe847d9ce5cf4cbdb7.tar.gz
avoid segfault on submodule.*.path set to an empty "true"jl/some-submodule-config-are-not-boolean
Git fails due to a segmentation fault if a submodule path is empty. Here is an example .gitmodules that will cause a segmentation fault: [submodule "foo-module"] path url = http://host/repo.git $ git status Segmentation fault (core dumped) This is because the parsing of "submodule.*.path" is not prepared to see a value-less "true" and assumes that the value is always non-NULL (parsing of "ignore" has the same problem). Fix it by checking the NULL-ness of value and complain with config_error_nonbool(). Signed-off-by: Jharrod LaFon <jlafon@eyesopen.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'submodule.c')
-rw-r--r--submodule.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/submodule.c b/submodule.c
index 975bc87e48..8f7515ed66 100644
--- a/submodule.c
+++ b/submodule.c
@@ -134,6 +134,9 @@ int parse_submodule_config_option(const char *var, const char *value)
return 0;
if (!strcmp(key, "path")) {
+ if (!value)
+ return config_error_nonbool(var);
+
config = unsorted_string_list_lookup(&config_name_for_path, value);
if (config)
free(config->util);
@@ -151,6 +154,9 @@ int parse_submodule_config_option(const char *var, const char *value)
} else if (!strcmp(key, "ignore")) {
char *name_cstr;
+ if (!value)
+ return config_error_nonbool(var);
+
if (strcmp(value, "untracked") && strcmp(value, "dirty") &&
strcmp(value, "all") && strcmp(value, "none")) {
warning("Invalid parameter \"%s\" for config option \"submodule.%s.ignore\"", value, var);