diff options
author | Toni <matzeton@googlemail.com> | 2021-05-09 15:09:43 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-09 15:09:43 +0200 |
commit | 8c28613eb27983272912d0b99e510eff5416ac60 (patch) | |
tree | 910dc86e4ae00811a7a01d9e9057a02615dcffcf /fuzz | |
parent | 0663544be8a0e0ea644655b736f9b0a47453c105 (diff) |
Check datalink during fuzzing to prevent console / logfile spam. See #1175 for more information. (#1177)
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
Diffstat (limited to 'fuzz')
-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); |