diff options
author | Nikolai Vladimirov <nikolay@vladimiroff.com> | 2013-08-05 21:53:09 +0300 |
---|---|---|
committer | Nikolai Vladimirov <nikolay@vladimiroff.com> | 2013-08-05 22:00:55 +0300 |
commit | f1af935b8918e9f9eae63219a434a7dedbff1c38 (patch) | |
tree | d8510fa1fb037f2e6019b89db43ab84ab1bce422 | |
parent | 9b7d02ff2d9b87d61778ee7ef5e2d43bf4c561f0 (diff) | |
download | libgit2-f1af935b8918e9f9eae63219a434a7dedbff1c38.tar.gz |
submodule: check alloc and name presense
-rw-r--r-- | src/submodule.c | 5 | ||||
-rw-r--r-- | tests-clar/resources/submodules/gitmodules | 3 |
2 files changed, 7 insertions, 1 deletions
diff --git a/src/submodule.c b/src/submodule.c index b4e917561..40bda9a41 100644 --- a/src/submodule.c +++ b/src/submodule.c @@ -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); diff --git a/tests-clar/resources/submodules/gitmodules b/tests-clar/resources/submodules/gitmodules index 1262f8bb0..2798b696c 100644 --- a/tests-clar/resources/submodules/gitmodules +++ b/tests-clar/resources/submodules/gitmodules @@ -1,3 +1,6 @@ [submodule "testrepo"] path = testrepo + url = +[submodule ""] + path = testrepo url =
\ No newline at end of file |