Browse Source

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>
maint
Junio C Hamano 17 years ago
parent
commit
896c0535af
  1. 2
      remote.c

2
remote.c

@ -220,11 +220,11 @@ static int handle_config(const char *key, const char *value) @@ -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)

Loading…
Cancel
Save