notes.c: fix a segfault in notes_display_config()
If notes.displayRef is configured with no value[1], control should be returned to the caller when notes.c:notes_display_config() checks if 'v' is NULL. Otherwise, both git log --notes and git diff-tree --notes will subsequently segfault when refs.h:has_glob_specials() calls strpbrk() with a NULL first argument. [1] Examples: .git/config: [notes] displayRef $ git -c notes.displayRef [...] Signed-off-by: Nate Avers <nate@roosteregg.cc> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
b86a4be245
commit
c3eb95a0d7
2
notes.c
2
notes.c
@ -967,7 +967,7 @@ static int notes_display_config(const char *k, const char *v, void *cb)
|
|||||||
|
|
||||||
if (*load_refs && !strcmp(k, "notes.displayref")) {
|
if (*load_refs && !strcmp(k, "notes.displayref")) {
|
||||||
if (!v)
|
if (!v)
|
||||||
config_error_nonbool(k);
|
return config_error_nonbool(k);
|
||||||
string_list_add_refs_by_glob(&display_notes_refs, v);
|
string_list_add_refs_by_glob(&display_notes_refs, v);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user