diff options
author | theirix <theirix@gmail.com> | 2016-07-25 12:58:27 +0300 |
---|---|---|
committer | theirix <theirix@gmail.com> | 2016-07-25 12:58:27 +0300 |
commit | d1f0b56adc56a35f98d8b5cabe426dc2408b65c9 (patch) | |
tree | 536e25f806e9b9e2c821cd6e1d6933a2506d42c5 /src/lib/protocols/dns.c | |
parent | 77fc4be458211087e5adf26b9d9067098a907697 (diff) |
Fixed payload overflow in MQTT, DNS
Diffstat (limited to 'src/lib/protocols/dns.c')
-rw-r--r-- | src/lib/protocols/dns.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lib/protocols/dns.c b/src/lib/protocols/dns.c index 7ee114579..5358cc8b7 100644 --- a/src/lib/protocols/dns.c +++ b/src/lib/protocols/dns.c @@ -80,7 +80,7 @@ void ndpi_search_dns(struct ndpi_detection_module_struct *ndpi_struct, struct nd } if((s_port == 53 || d_port == 53 || d_port == 5355) - && (flow->packet.payload_packet_len > sizeof(struct ndpi_dns_packet_header))) { + && (flow->packet.payload_packet_len > sizeof(struct ndpi_dns_packet_header)+x)) { struct ndpi_dns_packet_header dns_header; int invalid = 0; @@ -185,7 +185,7 @@ void ndpi_search_dns(struct ndpi_detection_module_struct *ndpi_struct, struct nd /* extract host name server */ int j = 0, max_len = sizeof(flow->host_server_name)-1, off = sizeof(struct ndpi_dns_packet_header) + 1; - while(flow->packet.payload[off] != '\0' && off < flow->packet.payload_packet_len) { + while(off < flow->packet.payload_packet_len && flow->packet.payload[off] != '\0') { flow->host_server_name[j] = flow->packet.payload[off]; if(j < max_len) { if(flow->host_server_name[j] < ' ') |