diff options
author | Luca Deri <deri@ntop.org> | 2019-11-12 12:28:34 +0100 |
---|---|---|
committer | Luca Deri <deri@ntop.org> | 2019-11-12 12:28:34 +0100 |
commit | ab9ccf9eb9a6571d84bd0b2c8e185565d0d700f6 (patch) | |
tree | cce99c96e6be6710995648517be74fb839dd314f | |
parent | 15ec013af8e6fd48c211e0ea14bf27739c9c4211 (diff) |
Fixed new nDPi API
-rw-r--r-- | example/ndpiReader.c | 2 | ||||
-rw-r--r-- | fuzz/Makefile.am | 2 | ||||
-rw-r--r-- | fuzz/fuzz_process_packet.c | 28 |
3 files changed, 16 insertions, 16 deletions
diff --git a/example/ndpiReader.c b/example/ndpiReader.c index 481254292..abf1bce54 100644 --- a/example/ndpiReader.c +++ b/example/ndpiReader.c @@ -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; diff --git a/fuzz/Makefile.am b/fuzz/Makefile.am index 4693d4076..10b4e593c 100644 --- a/fuzz/Makefile.am +++ b/fuzz/Makefile.am @@ -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) \ diff --git a/fuzz/fuzz_process_packet.c b/fuzz/fuzz_process_packet.c index 88319b419..56cafd983 100644 --- a/fuzz/fuzz_process_packet.c +++ b/fuzz/fuzz_process_packet.c @@ -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; } |