From: Douglas Bagnall Date: Thu, 16 Jan 2020 21:19:32 +0000 (+1300) Subject: fuzz_oLschema2ldif: check multiple possible NULLs X-Git-Tag: samba-4.12.0rc1~77 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6c7b722b3fa3d6383a22fb517d3cb5572115c365;p=thirdparty%2Fsamba.git fuzz_oLschema2ldif: check multiple possible NULLs Address sanitizer will object to a theoretically possible NULL dereference so we can't ignore these checks in set-up. Signed-off-by: Douglas Bagnall Reviewed-by: Andreas Schneider Autobuild-User(master): Andreas Schneider Autobuild-Date(master): Fri Jan 17 14:33:18 UTC 2020 on sn-devel-184 --- diff --git a/lib/fuzzing/fuzz_oLschema2ldif.c b/lib/fuzzing/fuzz_oLschema2ldif.c index a983f48d660..873e8f1ccc7 100644 --- a/lib/fuzzing/fuzz_oLschema2ldif.c +++ b/lib/fuzzing/fuzz_oLschema2ldif.c @@ -43,12 +43,23 @@ int LLVMFuzzerTestOneInput(uint8_t *buf, size_t len) } mem_ctx = talloc_init(__FUNCTION__); + if (mem_ctx == NULL) { + return 0; + } opt.in = fmemopen(buf, len, "r"); opt.out = devnull; opt.ldb_ctx = ldb_init(mem_ctx, NULL); + if (opt.ldb_ctx == NULL || opt.in == NULL) { + talloc_free(mem_ctx); + return 0; + } opt.basedn = ldb_dn_new(mem_ctx, opt.ldb_ctx, ""); + if (opt.basedn == NULL) { + talloc_free(mem_ctx); + return 0; + } process_file(mem_ctx, &opt);