Fixed buffer overflow in DNS dissection

This commit is contained in:
Luca Deri
2019-11-26 17:42:59 +01:00
parent c7efd0892f
commit c223bb1f10
2 changed files with 4 additions and 1 deletions
+3 -1
View File
@@ -47,7 +47,9 @@ static u_int16_t get16(int *i, const u_int8_t *payload) {
/* *********************************************** */
static u_int getNameLength(u_int i, const u_int8_t *payload, u_int payloadLen) {
if(payload[i] == 0x00)
if(i >= payloadLen)
return(0);
else if(payload[i] == 0x00)
return(1);
else if(payload[i] == 0xC0)
return(2);
+1
View File
@@ -492,6 +492,7 @@ void ndpi_search_irc_tcp(struct ndpi_detection_module_struct *ndpi_struct, struc
ndpi_parse_packet_line_info(ndpi_struct, flow);
} else {
flow->l4.tcp.irc_3a_counter++;
packet->parsed_lines = 0;
}
for (i = 0; i < packet->parsed_lines; i++) {
if (packet->line[i].ptr[0] == ':') {