aboutsummaryrefslogtreecommitdiff
path: root/src/lib/protocols/http.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/protocols/http.c')
-rw-r--r--src/lib/protocols/http.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/lib/protocols/http.c b/src/lib/protocols/http.c
index 9ac26785c..8f74d22ad 100644
--- a/src/lib/protocols/http.c
+++ b/src/lib/protocols/http.c
@@ -558,6 +558,14 @@ static void check_http_payload(struct ndpi_detection_module_struct *ndpi_struct,
/* ************************************************************* */
+#ifdef NDPI_ENABLE_DEBUG_MESSAGES
+static uint8_t non_ctrl(uint8_t c) {
+ return c < 32 ? '.':c;
+}
+#endif
+
+/* ************************************************************* */
+
/**
* Functions to check whether the packet begins with a valid http request
* @param ndpi_struct
@@ -589,8 +597,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 ? non_ctrl(packet->payload[0]) : '.',
+ packet->payload_packet_len > 1 ? non_ctrl(packet->payload[1]) : '.',
+ packet->payload_packet_len > 2 ? non_ctrl(packet->payload[2]) : '.',
+ packet->payload_packet_len > 3 ? non_ctrl(packet->payload[3]) : '.',
packet->payload_packet_len);
/* Check first char */