From 560280e6f082d22e6a9de8e537b7876bacf8d072 Mon Sep 17 00:00:00 2001 From: Ivan Nardi <12729895+IvanNardi@users.noreply.github.com> Date: Fri, 23 Dec 2022 19:07:13 +0100 Subject: fuzz: add fuzzer testing nDPI (initial) configurations (#1830) The goal of this fuzzer is to test init and deinit of the library, with different configurations. In details: * random memory allocation failures, even during init phase * random `ndpi_init_prefs` parameter of `ndpi_init_detection_module()` * random LRU caches sizes * random bitmask of enabled protocols * random parameters of `ndpi_set_detection_preferences()` * random initialization of opportunistic TLS * random load/don't load of configuration files This new fuzzer is a C++ file, because it uses `FuzzedDataProvider` class (see https://github.com/google/fuzzing/blob/master/docs/split-inputs.md). Note that the (existing) fuzzers need to be linked with C++ compiler anyway, so this new fuzzer doesn't add any new requirements. --- src/include/ndpi_api.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/include/ndpi_api.h') diff --git a/src/include/ndpi_api.h b/src/include/ndpi_api.h index bd754f1e1..5214c054f 100644 --- a/src/include/ndpi_api.h +++ b/src/include/ndpi_api.h @@ -264,9 +264,10 @@ extern "C" { * * @par ndpi_struct = the detection module * @par detection_bitmask = the protocol bitmask to set + * @return 0 if ok, -1 if error * */ - void ndpi_set_protocol_detection_bitmask2(struct ndpi_detection_module_struct *ndpi_struct, + int ndpi_set_protocol_detection_bitmask2(struct ndpi_detection_module_struct *ndpi_struct, const NDPI_PROTOCOL_BITMASK * detection_bitmask); /** -- cgit v1.2.3