From 56d87186f7e6d7dba042961be86d1b4b5ae9f2e3 Mon Sep 17 00:00:00 2001 From: Nardi Ivan Date: Sun, 14 Jun 2020 14:42:39 +0200 Subject: Fix compilation with --enable-debug-messages flag NDPI_LOG* macros dereference ndpi_detection_module_struct object which is private to ndpi library (via NDPI_LIB_COMPILATION define). So we can't use them outside the library itself, i.e. in ndpiReader code Therefore, in files in example/, convert all (rare) uses of NDPI_LOG* macros to a new very simple macro, private to ndpiReader program. If necessary, such macro may be improved. According to a comment in ndpi_define.h, each dissector must define its own NDPI_CURRENT_PROTO macro before including ndpi_api.h file --- src/lib/protocols/http.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/lib/protocols/http.c') diff --git a/src/lib/protocols/http.c b/src/lib/protocols/http.c index 7d54d1470..1032760d8 100644 --- a/src/lib/protocols/http.c +++ b/src/lib/protocols/http.c @@ -589,8 +589,10 @@ static u_int16_t http_request_url_offset(struct ndpi_detection_module_struct *nd int i; NDPI_LOG_DBG2(ndpi_struct, "====>>>> HTTP: %c%c%c%c [len: %u]\n", - non_ctrl(packet->payload[0]), non_ctrl(packet->payload[1]), - non_ctrl(packet->payload[2]), non_ctrl(packet->payload[3]), + packet->payload_packet_len > 0 ? packet->payload[0] : '.', + packet->payload_packet_len > 1 ? packet->payload[1] : '.', + packet->payload_packet_len > 2 ? packet->payload[2] : '.', + packet->payload_packet_len > 3 ? packet->payload[3] : '.', packet->payload_packet_len); /* Check first char */ -- cgit v1.2.3