aboutsummaryrefslogtreecommitdiff
path: root/fuzz/fuzz_ds_tree.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'fuzz/fuzz_ds_tree.cpp')
-rw-r--r--fuzz/fuzz_ds_tree.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/fuzz/fuzz_ds_tree.cpp b/fuzz/fuzz_ds_tree.cpp
index d06b5b19f..5e561e2e6 100644
--- a/fuzz/fuzz_ds_tree.cpp
+++ b/fuzz/fuzz_ds_tree.cpp
@@ -46,7 +46,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
*entry = fuzzed_data.ConsumeIntegral<u_int32_t>();
if(ndpi_tfind(entry, &root, __compare) == NULL) {
- if(ndpi_tsearch(entry, &root, __compare) == NULL) {
+ if(ndpi_tsearch(entry, fuzzed_data.ConsumeBool() ? &root : NULL, __compare) == NULL) {
ndpi_free(entry);
} else {
/* Keep one random entry really added */
@@ -65,7 +65,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
for (i = 0; i < num_iteration; i++) {
e = fuzzed_data.ConsumeIntegral<u_int32_t>();
- ndpi_tfind(&e, &root, __compare);
+ ndpi_tfind(&e, fuzzed_data.ConsumeBool() ? &root : NULL, __compare);
}
/* Search of an added node */
if (is_added) {