aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuca Deri <deri@ntop.org>2020-05-22 07:24:02 +0200
committerLuca Deri <deri@ntop.org>2020-05-22 07:24:02 +0200
commitbbbc5fdbae79c72dbe157e02dfee4ef9f18014b5 (patch)
tree0ee007c25249cdddabc299beafa10a3c7ca1b0d2
parent3874f0e0e0293dd977fda31d3f50c69ebcad4463 (diff)
Added memory boundary checks
-rw-r--r--src/lib/ndpi_main.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/lib/ndpi_main.c b/src/lib/ndpi_main.c
index f1338ea74..f93f0bfd3 100644
--- a/src/lib/ndpi_main.c
+++ b/src/lib/ndpi_main.c
@@ -4858,7 +4858,8 @@ void ndpi_parse_packet_line_info(struct ndpi_detection_module_struct *ndpi_str,
if(get_u_int16_t(packet->payload, a) == ntohs(0x0d0a)) {
/* If end of line char sequence CR+NL "\r\n", process line */
- if(get_u_int16_t(packet->payload, a+2) == ntohs(0x0d0a)) {
+ if(((a + 3) <= packet->payload_packet_len)
+ && (get_u_int16_t(packet->payload, a+2) == ntohs(0x0d0a))) {
/* \r\n\r\n */
int diff; /* No unsigned ! */
u_int32_t a1 = a + 4;