Hardening fixes for packer parsing

This commit is contained in:
Luca Deri
2019-05-03 18:08:12 +02:00
parent 361ab030bc
commit e99a0abfba
2 changed files with 7 additions and 3 deletions
+2 -1
View File
@@ -5036,7 +5036,8 @@ 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)
&& (packet->parsed_lines < NDPI_MAX_PARSE_LINES_PER_PACKET); a++) {
if((a + 1) == packet->payload_packet_len)
return; /* Return if only one byte remains (prevent invalid reads past end-of-buffer) */