mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-28 10:28:56 +00:00
Merge pull request #1763 from nvloff/nameless_submodule_segfault
submodule: check alloc and name presence
This commit is contained in:
commit
ee77378d9b
@ -1025,6 +1025,7 @@ static int submodule_get(
|
||||
|
||||
if (!git_strmap_valid_index(smcfg, pos)) {
|
||||
sm = submodule_alloc(repo, name);
|
||||
GITERR_CHECK_ALLOC(sm);
|
||||
|
||||
/* insert value at name - if another thread beats us to it, then use
|
||||
* their record and release our own.
|
||||
@ -1101,8 +1102,10 @@ static int submodule_load_from_config(
|
||||
|
||||
namestart = key + strlen("submodule.");
|
||||
property = strrchr(namestart, '.');
|
||||
if (property == NULL)
|
||||
|
||||
if (!property || (property == namestart))
|
||||
return 0;
|
||||
|
||||
property++;
|
||||
is_path = (strcasecmp(property, "path") == 0);
|
||||
|
||||
|
@ -1,3 +1,6 @@
|
||||
[submodule "testrepo"]
|
||||
path = testrepo
|
||||
url =
|
||||
[submodule ""]
|
||||
path = testrepo
|
||||
url =
|
Loading…
Reference in New Issue
Block a user