Check datalink during fuzzing to prevent console / logfile spam. See #1175 for more information. (#1177)

Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
This commit is contained in:
Toni
2021-05-09 15:09:43 +02:00
committed by GitHub
parent 0663544be8
commit 8c28613eb2
3 changed files with 8 additions and 9 deletions
+8
View File
@@ -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);