@matheusbsbs / matheus-bagliano / commits / 896c0535af
Fork 0

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>

Junio C Hamano committed Dec 14, 2007 at 20:34 UTC 896c0535afe2f00683f7d4e8171fad7ec156f16f
1 file changed +1 -1
remote.c
+1 -1
@@ -220,11 +220,11 @@ static int handle_config(const char *key, const char *value)
220 if (!prefixcmp(key, "branch.")) {
221 name = key + 7;
222 subkey = strrchr(name, '.');
223 - branch = make_branch(name, subkey - name);
223 if (!subkey)
224 return 0;
225 if (!value)
226 return 0;
227 + branch = make_branch(name, subkey - name);
228 if (!strcmp(subkey, ".remote")) {
229 branch->remote_name = xstrdup(value);
230 if (branch == current_branch)