summaryrefslogtreecommitdiff
path: root/remote.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2007-12-14 20:34:56 -0800
committerJunio C Hamano <gitster@pobox.com>2007-12-14 20:34:56 -0800
commit896c0535afe2f00683f7d4e8171fad7ec156f16f (patch)
treeea5c7c05370fe04b1ecd9917290ed55eb082ac83 /remote.c
parent1eb1e9eea480059d4fba171e74a4375b8191e3f3 (diff)
downloadgit-896c0535afe2f00683f7d4e8171fad7ec156f16f.tar.gz
remote: Fix bogus make_branch() call in configuration reader.
The configuration reader to enumerate branches that have configuration data were not careful enough and failed to skip "branch.<variable>" entries (e.g. branch.autosetupmerge). This resulted in bogus attempt to allocate huge memory. Noticed by David Miller. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'remote.c')
-rw-r--r--remote.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/remote.c b/remote.c
index 3fb0f99b29..0e006804ef 100644
--- a/remote.c
+++ b/remote.c
@@ -220,11 +220,11 @@ static int handle_config(const char *key, const char *value)
if (!prefixcmp(key, "branch.")) {
name = key + 7;
subkey = strrchr(name, '.');
- branch = make_branch(name, subkey - name);
if (!subkey)
return 0;
if (!value)
return 0;
+ branch = make_branch(name, subkey - name);
if (!strcmp(subkey, ".remote")) {
branch->remote_name = xstrdup(value);
if (branch == current_branch)