mirror of
https://github.com/libgit2/libgit2.git
synced 2026-01-25 02:56:17 +00:00
config: Fix potential null value passed to %s
config.c:1448:59: warning: '%s' directive argument is null [-Wformat-overflow=]
1448 | git_error_set(GIT_ERROR_CONFIG, "failed to parse '%s' as a boolean value", value);
| ^~
This commit is contained in:
@@ -1442,6 +1442,8 @@ int git_config_parse_bool(int *out, const char *value)
|
||||
if (git__parse_bool(out, value) == 0)
|
||||
return 0;
|
||||
|
||||
/* git__parse_bool returns 0 for NULL, so this assertion should be correct */
|
||||
GIT_ASSERT_ARG(value);
|
||||
if (git_config_parse_int32(out, value) == 0) {
|
||||
*out = !!(*out);
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user