Fixed new nDPi API

This commit is contained in:
Luca Deri
2019-11-12 12:28:34 +01:00
parent 15ec013af8
commit ab9ccf9eb9
3 changed files with 16 additions and 16 deletions
+1 -1
View File
@@ -4169,7 +4169,7 @@ int orginal_main(int argc, char **argv) {
analyzeUnitTest();
gettimeofday(&startup_time, NULL);
ndpi_info_mod = ndpi_init_detection_module(0 /* Don't skip tor hosts */);
ndpi_info_mod = ndpi_init_detection_module(ndpi_no_prefs);
if(ndpi_info_mod == NULL) return -1;
+1 -1
View File
@@ -5,7 +5,7 @@ fuzz_process_packet_LDFLAGS = ../src/lib/libndpi.a
if HAS_FUZZLDFLAGS
fuzz_process_packet_LDFLAGS += $(LIB_FUZZING_ENGINE)
else
fuzz_process_packet_SOURCES += onefile.c
fuzz_process_packet_SOURCES += # onefile.c
endif
# force usage of CXX for linker
fuzz_process_packet_LINK=$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+14 -14
View File
@@ -9,20 +9,20 @@ struct ndpi_id_struct *src;
struct ndpi_id_struct *dst;
int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
if (ndpi_info_mod == NULL) {
ndpi_info_mod = ndpi_init_detection_module();
NDPI_PROTOCOL_BITMASK all;
NDPI_BITMASK_SET_ALL(all);
ndpi_set_protocol_detection_bitmask2(ndpi_info_mod, &all);
ndpi_flow = ndpi_flow_malloc(SIZEOF_FLOW_STRUCT);
src = ndpi_malloc(SIZEOF_ID_STRUCT);
dst = ndpi_malloc(SIZEOF_ID_STRUCT);
}
if (ndpi_info_mod == NULL) {
ndpi_info_mod = ndpi_init_detection_module(ndpi_no_prefs);
NDPI_PROTOCOL_BITMASK all;
NDPI_BITMASK_SET_ALL(all);
ndpi_set_protocol_detection_bitmask2(ndpi_info_mod, &all);
ndpi_flow = ndpi_flow_malloc(SIZEOF_FLOW_STRUCT);
src = ndpi_malloc(SIZEOF_ID_STRUCT);
dst = ndpi_malloc(SIZEOF_ID_STRUCT);
}
memset(ndpi_flow, 0, SIZEOF_FLOW_STRUCT);
memset(src, 0, SIZEOF_ID_STRUCT);
memset(dst, 0, SIZEOF_ID_STRUCT);
ndpi_detection_process_packet(ndpi_info_mod, ndpi_flow, Data, Size, 0, src, dst);
memset(ndpi_flow, 0, SIZEOF_FLOW_STRUCT);
memset(src, 0, SIZEOF_ID_STRUCT);
memset(dst, 0, SIZEOF_ID_STRUCT);
ndpi_detection_process_packet(ndpi_info_mod, ndpi_flow, Data, Size, 0, src, dst);
return 0;
return 0;
}