git/compat
Jeff King ba176db511 config: handle NULL value when parsing non-bools
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>
2023-12-09 08:24:39 +09:00
..
fsmonitor fsmonitor/darwin: mark unused parameters in system callback 2023-09-18 15:56:15 -07:00
linux treewide: remove unnecessary cache.h inclusion from several sources 2023-03-21 10:56:51 -07:00
nedmalloc
poll
regex
simple-ipc cache.h: remove this no-longer-used header 2023-06-21 13:39:53 -07:00
stub
vcbuild
win32 Merge branch 'ds/maintenance-on-windows-fix' 2023-08-15 10:19:47 -07:00
.gitattributes
access.c
apple-common-crypto.h
basename.c
bswap.h
compiler.h
disk.h abspath.h: move absolute path functions from cache.h 2023-03-21 10:56:52 -07:00
fileno.c
fopen.c
hstrerror.c
inet_ntop.c
inet_pton.c
memmem.c
mingw.c config: handle NULL value when parsing non-bools 2023-12-09 08:24:39 +09:00
mingw.h Merge branch 'ma/locate-in-path-for-windows' 2023-08-09 16:18:16 -07:00
mkdir.c
mkdtemp.c
mmap.c
msvc.c
msvc.h
nonblock.c mark unused parameters in trivial compat functions 2022-10-17 21:24:03 -07:00
nonblock.h
obstack.c
obstack.h
open.c
pread.c treewide: remove double forward declaration of read_in_full 2023-04-11 08:52:11 -07:00
precompose_utf8.c cache.h: remove this no-longer-used header 2023-06-21 13:39:53 -07:00
precompose_utf8.h
qsort_s.c
regcomp_enhanced.c use enhanced basic regular expressions on macOS 2023-01-08 10:06:34 +09:00
setenv.c
sha1-chunked.c cache.h: remove this no-longer-used header 2023-06-21 13:39:53 -07:00
sha1-chunked.h
snprintf.c
stat.c
strcasestr.c
strdup.c
strlcpy.c
strtoimax.c
strtoumax.c
terminal.c hashmap: use expected signatures for comparison functions 2023-08-19 21:17:53 -07:00
terminal.h
unsetenv.c
win32.h
win32mmap.c
winansi.c compat/winansi: check for errors of CreateThread() correctly 2023-02-01 14:36:19 -08:00
zlib-uncompress2.c