mirror of
https://github.com/vel21ripn/nDPI.git
synced 2026-04-29 15:39:42 +00:00
fuzzing: improve coverage (#2495)
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)
This commit is contained in:
parent
456f0fd427
commit
c3ba65311e
19 changed files with 142 additions and 63 deletions
|
|
@ -30,7 +30,8 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
|||
for (i = 0; i < num_iteration; i++) {
|
||||
value = fuzzed_data.ConsumeBytesAsString(fuzzed_data.ConsumeIntegral<u_int8_t>());
|
||||
class_id = fuzzed_data.ConsumeIntegral<u_int16_t>();
|
||||
rc = ndpi_domain_classify_add(ndpi_struct, d, class_id, (char*)value.c_str());
|
||||
rc = ndpi_domain_classify_add(fuzzed_data.ConsumeBool() ? ndpi_struct : NULL,
|
||||
d, class_id, (char*)value.c_str());
|
||||
|
||||
/* Keep one random entry really added */
|
||||
if (rc == true && is_added == 0 && fuzzed_data.ConsumeBool()) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue