When the config parser sees an "implicit" bool like:
[core]
someVariable
it passes NULL to the config callback. Any callback code which expects a
string must check for NULL. This usually happens via helpers like
git_config_string(), etc, but some custom code forgets to do so and will
segfault.
These are all fairly vanilla cases where the solution is just the usual
pattern of:
if (!value)
return config_error_nonbool(var);
though note that in a few cases we have to split initializers like:
int some_var = initializer();
into:
int some_var;
if (!value)
return config_error_nonbool(var);
some_var = initializer();
There are still some broken instances after this patch, which I'll
address on their own in individual patches after this one.
Reported-by: Carlos Andrés Ramírez Cataño <antaigroupltda@gmail.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
|
||
|---|---|---|
| .. | ||
| fsmonitor | ||
| linux | ||
| nedmalloc | ||
| poll | ||
| regex | ||
| simple-ipc | ||
| stub | ||
| vcbuild | ||
| win32 | ||
| .gitattributes | ||
| access.c | ||
| apple-common-crypto.h | ||
| basename.c | ||
| bswap.h | ||
| compiler.h | ||
| disk.h | ||
| fileno.c | ||
| fopen.c | ||
| hstrerror.c | ||
| inet_ntop.c | ||
| inet_pton.c | ||
| memmem.c | ||
| mingw.c | ||
| mingw.h | ||
| mkdir.c | ||
| mkdtemp.c | ||
| mmap.c | ||
| msvc.c | ||
| msvc.h | ||
| nonblock.c | ||
| nonblock.h | ||
| obstack.c | ||
| obstack.h | ||
| open.c | ||
| pread.c | ||
| precompose_utf8.c | ||
| precompose_utf8.h | ||
| qsort_s.c | ||
| regcomp_enhanced.c | ||
| setenv.c | ||
| sha1-chunked.c | ||
| sha1-chunked.h | ||
| snprintf.c | ||
| stat.c | ||
| strcasestr.c | ||
| strdup.c | ||
| strlcpy.c | ||
| strtoimax.c | ||
| strtoumax.c | ||
| terminal.c | ||
| terminal.h | ||
| unsetenv.c | ||
| win32.h | ||
| win32mmap.c | ||
| winansi.c | ||
| zlib-uncompress2.c | ||