fuzz: extend fuzzing coverage
This commit is contained in:
@@ -31,7 +31,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
||||
ndpi_risk flow_risk;
|
||||
const u_char *pkt;
|
||||
struct pcap_pkthdr *header;
|
||||
int r;
|
||||
int r, rc;
|
||||
char errbuf[PCAP_ERRBUF_SIZE];
|
||||
FILE *fd;
|
||||
u_int8_t debug_protos_index;
|
||||
@@ -91,14 +91,16 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
||||
w = ndpi_workflow_init(&prefs, pcap_handle, 1, serialization_format);
|
||||
if(w) {
|
||||
NDPI_BITMASK_SET_ALL(enabled_bitmask);
|
||||
ndpi_set_protocol_detection_bitmask2(w->ndpi_struct, &enabled_bitmask);
|
||||
ndpi_finalize_initialization(w->ndpi_struct);
|
||||
rc = ndpi_set_protocol_detection_bitmask2(w->ndpi_struct, &enabled_bitmask);
|
||||
if(rc == 0) {
|
||||
ndpi_finalize_initialization(w->ndpi_struct);
|
||||
|
||||
header = NULL;
|
||||
r = pcap_next_ex(pcap_handle, &header, &pkt);
|
||||
while (r > 0) {
|
||||
ndpi_workflow_process_packet(w, header, pkt, &flow_risk);
|
||||
header = NULL;
|
||||
r = pcap_next_ex(pcap_handle, &header, &pkt);
|
||||
while (r > 0) {
|
||||
ndpi_workflow_process_packet(w, header, pkt, &flow_risk);
|
||||
r = pcap_next_ex(pcap_handle, &header, &pkt);
|
||||
}
|
||||
}
|
||||
|
||||
ndpi_workflow_free(w);
|
||||
|
||||
Reference in New Issue
Block a user