Skip to content

Commit c4d7fa9

Browse files
committed
config_file: Don't crash on options without a section
1 parent 64138b7 commit c4d7fa9

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/config_file.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1035,6 +1035,10 @@ static int read_on_variable(
10351035
GIT_UNUSED(line);
10361036
GIT_UNUSED(line_len);
10371037

1038+
if (!current_section) {
1039+
giterr_set(GITERR_CONFIG, "no section for key: %s", var_name);
1040+
return -1;
1041+
}
10381042
git_buf_puts(&buf, current_section);
10391043
git_buf_putc(&buf, '.');
10401044
for (c = var_name; *c; c++)

0 commit comments

Comments
 (0)