From 19a8a3056ee63d14e3785e348208673ff44bf7ec Mon Sep 17 00:00:00 2001 From: David Korczynski Date: Tue, 26 Sep 2023 17:32:47 +0100 Subject: [PATCH] tests: fuzzers: fix possible NULL deref We need to check for NULL here since we can cause mallocs to fail. Signed-off-by: David Korczynski --- tests/internal/fuzzers/fstore_fuzzer.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/internal/fuzzers/fstore_fuzzer.c b/tests/internal/fuzzers/fstore_fuzzer.c index 92ecf5d7a2d..e2a95106be3 100644 --- a/tests/internal/fuzzers/fstore_fuzzer.c +++ b/tests/internal/fuzzers/fstore_fuzzer.c @@ -61,6 +61,9 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) cio_utils_recursive_delete(FSF_STORE_PATH); fs = flb_fstore_create(FSF_STORE_PATH, FLB_FSTORE_FS); + if (fs == NULL) { + return 0; + } st = flb_fstore_stream_create(fs, "abc"); if (st != NULL) { fsf = flb_fstore_file_create(fs, st, "example.txt", size);