mirror of
https://github.com/vel21ripn/nDPI.git
synced 2026-05-04 01:40:19 +00:00
Fix detection of WebDAV and Gnutella (over HTTP) Fix detection of z3950 Add two fuzzers to test `ndpi_memmem()` and `ndpi_strnstr()` Remove some dead code: * RTP: the same exact check is performed at the very beginning of the function * MQTT: use a better helper to exclude the protocol * Colletd: `ndpi_hostname_sni_set()` never fails Update pl7m code (fix a Use-of-uninitialized-value error)
18 lines
497 B
C++
18 lines
497 B
C++
#include "ndpi_api.h"
|
|
|
|
#include "fuzzer/FuzzedDataProvider.h"
|
|
|
|
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
|
FuzzedDataProvider fuzzed_data(data, size);
|
|
u_int16_t len;
|
|
|
|
/* No real memory allocations involved */
|
|
|
|
len = fuzzed_data.ConsumeIntegral<u_int16_t>();
|
|
std::string haystack = fuzzed_data.ConsumeRandomLengthString();
|
|
std::string needle = fuzzed_data.ConsumeRandomLengthString();
|
|
|
|
ndpi_strnstr(haystack.c_str(), needle.c_str(), len);
|
|
|
|
return 0;
|
|
}
|