Skip to content

Commit c3eb95a

Browse files
nateaversgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent b86a4be commit c3eb95a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

notes.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -967,7 +967,7 @@ static int notes_display_config(const char *k, const char *v, void *cb)
967967

968968
if (*load_refs && !strcmp(k, "notes.displayref")) {
969969
if (!v)
970-
config_error_nonbool(k);
970+
return config_error_nonbool(k);
971971
string_list_add_refs_by_glob(&display_notes_refs, v);
972972
}
973973

0 commit comments

Comments
 (0)