diff --git a/example/ndpiReader.c b/example/ndpiReader.c index 2643730bb3c6..42ac545796eb 100644 --- a/example/ndpiReader.c +++ b/example/ndpiReader.c @@ -254,6 +254,7 @@ static int dpdk_port_id = 0, dpdk_run_capture = 1; void test_lib(); /* Forward */ extern void ndpi_report_payload_stats(FILE *out); +extern int parse_proto_name_list(char *str, NDPI_PROTOCOL_BITMASK *bitmask, int inverted_logic); /* ********************************** */ @@ -930,9 +931,9 @@ int __add_cfg(char *proto, char *param, char *value, int dup) printf("Too many parameter! [num:%d/%d]\n", num_cfgs, MAX_NUM_CFGS); return -1; } - cfgs[num_cfgs].proto = ndpi_strdup(proto); - cfgs[num_cfgs].param = ndpi_strdup(param); - cfgs[num_cfgs].value = ndpi_strdup(value); + cfgs[num_cfgs].proto = dup ? ndpi_strdup(proto) : proto; + cfgs[num_cfgs].param = dup ? ndpi_strdup(param) : param; + cfgs[num_cfgs].value = dup ? ndpi_strdup(value) : value; num_cfgs++; return 0; } diff --git a/fuzz/fuzz_readerutils_workflow.cpp b/fuzz/fuzz_readerutils_workflow.cpp index 07031c3026c9..67e112c46028 100644 --- a/fuzz/fuzz_readerutils_workflow.cpp +++ b/fuzz/fuzz_readerutils_workflow.cpp @@ -90,13 +90,14 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { if(w) { ndpi_set_config(w->ndpi_struct, NULL, "flow.track_payload.enable", "1"); ndpi_set_config(w->ndpi_struct, NULL, "tcp_ack_payload_heuristic.enable", "1"); - ndpi_finalize_initialization(w->ndpi_struct); + if(ndpi_finalize_initialization(w->ndpi_struct) != 0) { - 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);