From c3eb95a0d759d80d53ccb396627c400cd3db6e6d Mon Sep 17 00:00:00 2001 From: Nate Avers Date: Sun, 22 Nov 2020 22:23:41 -0500 Subject: 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 Signed-off-by: Junio C Hamano --- notes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'notes.c') diff --git a/notes.c b/notes.c index 03e7d0cd2d..928dde8b34 100644 --- a/notes.c +++ b/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 (!v) - config_error_nonbool(k); + return config_error_nonbool(k); string_list_add_refs_by_glob(&display_notes_refs, v); } -- cgit v1.2.3