diff options
author | emanuele-f <faranda@ntop.org> | 2019-12-04 18:34:08 +0100 |
---|---|---|
committer | emanuele-f <faranda@ntop.org> | 2019-12-04 18:34:08 +0100 |
commit | 226a9abf2235fd9e87353ffe727babad71fb7274 (patch) | |
tree | 2bd41b665a744ac14653d0b6f795b2aeb74723b4 /src/lib/ndpi_main.c | |
parent | f26096ee4cf730244b3db577259f84b0cd37e521 (diff) |
Additional memory bounds checks
Diffstat (limited to 'src/lib/ndpi_main.c')
-rw-r--r-- | src/lib/ndpi_main.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/lib/ndpi_main.c b/src/lib/ndpi_main.c index 40bf9ae20..18173d555 100644 --- a/src/lib/ndpi_main.c +++ b/src/lib/ndpi_main.c @@ -4252,6 +4252,8 @@ ndpi_protocol ndpi_detection_giveup(struct ndpi_detection_module_struct *ndpi_st if(flow->host_server_name[0] != '\0') { ndpi_protocol_match_result ret_match; + memset(&ret_match, 0, sizeof(ret_match)); + ndpi_match_host_subprotocol(ndpi_str, flow, (char *)flow->host_server_name, strlen((const char*)flow->host_server_name), @@ -5096,7 +5098,7 @@ void ndpi_parse_packet_line_info(struct ndpi_detection_module_struct *ndpi_str, for(a = 0; (a < packet->payload_packet_len) && (packet->parsed_lines < NDPI_MAX_PARSE_LINES_PER_PACKET); a++) { - if((a + 1) == packet->payload_packet_len) + if((a + 1) >= packet->payload_packet_len) return; /* Return if only one byte remains (prevent invalid reads past end-of-buffer) */ if(get_u_int16_t(packet->payload, a) == ntohs(0x0d0a)) { /* If end of line char sequence CR+NL "\r\n", process line */ |