Commit f1af935b by Nikolai Vladimirov

submodule: check alloc and name presense

parent 9b7d02ff
...@@ -1025,6 +1025,7 @@ static int submodule_get( ...@@ -1025,6 +1025,7 @@ static int submodule_get(
if (!git_strmap_valid_index(smcfg, pos)) { if (!git_strmap_valid_index(smcfg, pos)) {
sm = submodule_alloc(repo, name); sm = submodule_alloc(repo, name);
GITERR_CHECK_ALLOC(sm);
/* insert value at name - if another thread beats us to it, then use /* insert value at name - if another thread beats us to it, then use
* their record and release our own. * their record and release our own.
...@@ -1101,8 +1102,10 @@ static int submodule_load_from_config( ...@@ -1101,8 +1102,10 @@ static int submodule_load_from_config(
namestart = key + strlen("submodule."); namestart = key + strlen("submodule.");
property = strrchr(namestart, '.'); property = strrchr(namestart, '.');
if (property == NULL)
if (!property || (property == namestart))
return 0; return 0;
property++; property++;
is_path = (strcasecmp(property, "path") == 0); is_path = (strcasecmp(property, "path") == 0);
......
[submodule "testrepo"] [submodule "testrepo"]
path = testrepo path = testrepo
url = url =
[submodule ""]
path = testrepo
url =
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment