blob: 49a7aebb72855832c5e5b4e51d0d69d5138c47e9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
#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);
ndpi_str_endswith(haystack.c_str(), needle.c_str());
return 0;
}
|