diff options
author | Jakub Jelen <jjelen@redhat.com> | 2020-04-20 18:16:35 +0200 |
---|---|---|
committer | Frediano Ziglio <freddy77@gmail.com> | 2020-04-26 21:35:07 +0100 |
commit | aebeee08e245d630c0d5e4e85a8678702aa96347 (patch) | |
tree | f4d7110f5c2a7f517c0dc5feffe9a8a927fb7546 /src | |
parent | 0424cfbe6562c49154e2feef4ad51ca8807c8a42 (diff) |
vcard_emul_nss: Avoid null deref when parsing options
Error from fuzzer:
==7==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x0000004e1a32 bp 0x7ffdf742d050 sp 0x7ffdf742cfa0 T0)
==7==The signal is caused by a READ memory access.
==7==Hint: address points to the zero page.
SCARINESS: 10 (null-deref)
#0 0x4e1a32 in vcard_emul_options /work/meson/../../src/libcacard/src/vcard_emul_nss.c:1282:13
#1 0x4cb79e in LLVMFuzzerTestOneInput /work/meson/../../src/libcacard/fuzz/fuzz_options.c:54:15
[...]
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/vcard_emul_nss.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/vcard_emul_nss.c b/src/vcard_emul_nss.c index d74edd4..a22aa41 100644 --- a/src/vcard_emul_nss.c +++ b/src/vcard_emul_nss.c @@ -1234,7 +1234,7 @@ static VCardEmulOptions options; #define NEXT_TOKEN(token) \ (token) = args; \ args = strpbrk(args, ",)"); \ - if (*args == 0 || *args == ')') { \ + if (args == NULL || *args == 0 || *args == ')') { \ fprintf(stderr, "Error: invalid soft specification.\n"); \ return NULL; \ } \ |