1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-10 06:06:10 +02:00

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:
Nate Avers 2020-11-22 22:23:41 -05:00 committed by Junio C Hamano
parent b86a4be245
commit c3eb95a0d7

View File

@ -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 (!v)
config_error_nonbool(k);
return config_error_nonbool(k);
string_list_add_refs_by_glob(&display_notes_refs, v);
}