Skip to content

Commit ecc722c

Browse files
committed
Fix a string parsing bug when validating extensions from the configuration
As builtin extensions are evaluated in the latter half of `check_valid_extension`, a string `cfg` is concatenated with the static string 'extension.' and the value from `builtin_extension`, before being compared with the configured value. This string is not being cleared while iterating through the names of the extensions. Because there is currently only one extension ('noop'), the bug was never noticible. This patch corrects the behavior by clearing the string on each iteration, as is done in the first block.
1 parent 2a0d0bd commit ecc722c

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/libgit2/repository.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1462,6 +1462,7 @@ static int check_valid_extension(const git_config_entry *entry, void *payload)
14621462
}
14631463

14641464
for (i = 0; i < ARRAY_SIZE(builtin_extensions); i++) {
1465+
git_str_clear(&cfg);
14651466
extension = builtin_extensions[i];
14661467

14671468
if ((error = git_str_printf(&cfg, "extensions.%s", extension)) < 0)

0 commit comments

Comments
 (0)