fuzz_oLschema2ldif: check multiple possible NULLs
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Thu, 16 Jan 2020 21:19:32 +0000 (10:19 +1300)
committerAndreas Schneider <asn@cryptomilk.org>
Fri, 17 Jan 2020 14:33:18 +0000 (14:33 +0000)
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 <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Fri Jan 17 14:33:18 UTC 2020 on sn-devel-184

lib/fuzzing/fuzz_oLschema2ldif.c

index a983f48d660ecac3082618fa3ab1887642d12192..873e8f1ccc79326f1075560d1b8a4e827f437a61 100644 (file)
@@ -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);