summaryrefslogtreecommitdiff
path: root/lib/fuzzing
diff options
context:
space:
mode:
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>2020-01-17 10:19:32 +1300
committerAndreas Schneider <asn@cryptomilk.org>2020-01-17 14:33:18 +0000
commit6c7b722b3fa3d6383a22fb517d3cb5572115c365 (patch)
tree0ad6b4ac0ba8bfa3f7310709848eee5ffaa7c20c /lib/fuzzing
parent6786ec2c9638f13efed8cba156e174644804a61e (diff)
downloadsamba-6c7b722b3fa3d6383a22fb517d3cb5572115c365.tar.gz
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 <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
Diffstat (limited to 'lib/fuzzing')
-rw-r--r--lib/fuzzing/fuzz_oLschema2ldif.c11
1 files changed, 11 insertions, 0 deletions
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);