mirror of
https://github.com/git/git.git
synced 2024-11-23 18:05:29 +08:00
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>
This commit is contained in:
parent
1eb1e9eea4
commit
896c0535af
2
remote.c
2
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)
|
||||
|
Loading…
Reference in New Issue
Block a user