diff options
Diffstat (limited to 'fuzz/fuzz_ndpi_reader.c')
-rw-r--r-- | fuzz/fuzz_ndpi_reader.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/fuzz/fuzz_ndpi_reader.c b/fuzz/fuzz_ndpi_reader.c index 85d7c317a..49460ef4f 100644 --- a/fuzz/fuzz_ndpi_reader.c +++ b/fuzz/fuzz_ndpi_reader.c @@ -66,6 +66,14 @@ int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { free(pcap_path); return 0; } + if (ndpi_is_datalink_supported(pcap_datalink(pkts)) == 0) + { + /* Do not fail if the datalink type is not supported (may happen often during fuzzing). */ + pcap_close(pkts); + remove(pcap_path); + free(pcap_path); + return 0; + } struct ndpi_workflow * workflow = ndpi_workflow_init(prefs, pkts); // enable all protocols NDPI_BITMASK_SET_ALL(all); |