diff options
author | Luca Deri <deri@ntop.org> | 2018-09-05 23:23:54 +0200 |
---|---|---|
committer | Luca Deri <deri@ntop.org> | 2018-09-05 23:23:54 +0200 |
commit | 6373c355cfd497d57609b8ecfc62717758ac7154 (patch) | |
tree | 1d0c1bc54714ea8860a8192c603db0be6814a5a0 /src/lib/ndpi_main.c | |
parent | 225826ce83c224000a8c5f8e72cb33a1f2559fd9 (diff) |
Added fix for out of boundary memory access
Fixes warning
Diffstat (limited to 'src/lib/ndpi_main.c')
-rw-r--r-- | src/lib/ndpi_main.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lib/ndpi_main.c b/src/lib/ndpi_main.c index 557c5b455..ebc209f68 100644 --- a/src/lib/ndpi_main.c +++ b/src/lib/ndpi_main.c @@ -1935,7 +1935,7 @@ static void ndpi_init_protocol_defaults(struct ndpi_detection_module_struct *ndp static int ac_match_handler(AC_MATCH_t *m, AC_TEXT_t *txt, AC_REP_t *match) { int min_len = (txt->length < m->patterns->length) ? txt->length : m->patterns->length; - char buf[64]; + char buf[64] = { '\0' }; int min_buf_len = (txt->length > 63 /* sizeof(buf)-1 */) ? 63 : txt->length; u_int buf_len = strlen(buf); @@ -4607,7 +4607,7 @@ void ndpi_parse_packet_line_info(struct ndpi_detection_module_struct *ndpi_struc packet->line[packet->parsed_lines].ptr = packet->payload; packet->line[packet->parsed_lines].len = 0; - for(a = 0; a < packet->payload_packet_len; a++) { + for(a = 0; a < packet->payload_packet_len-2; a++) { if(get_u_int16_t(packet->payload, a) == ntohs(0x0d0a)) { /* If end of line char sequence CR+NL "\r\n", process line */ packet->line[packet->parsed_lines].len = (u_int16_t)(((unsigned long) &packet->payload[a]) - ((unsigned long) packet->line[packet->parsed_lines].ptr)); |