diff options
author | theirix <theirix@gmail.com> | 2016-04-19 18:08:23 +0300 |
---|---|---|
committer | theirix <theirix@gmail.com> | 2016-05-24 23:34:15 +0300 |
commit | 552076a36c0af486a8c25dbd31905ad6feb71498 (patch) | |
tree | ac7dffea27c718d971fd5b1afe112a356de9e0a3 /src/lib/protocols/dns.c | |
parent | a0fe6665b24f6a7987d5cb6aed44e1ef461b8be1 (diff) |
Fixed dns buffer overflow
Diffstat (limited to 'src/lib/protocols/dns.c')
-rw-r--r-- | src/lib/protocols/dns.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/src/lib/protocols/dns.c b/src/lib/protocols/dns.c index f8b50f733..98df46481 100644 --- a/src/lib/protocols/dns.c +++ b/src/lib/protocols/dns.c @@ -112,10 +112,8 @@ void ndpi_search_dns(struct ndpi_detection_module_struct *ndpi_struct, struct nd ret_code = (is_query == 0) ? 0 : (dns_header.flags & 0x0F); int j = 0; int off = sizeof(struct ndpi_dns_packet_header) + 1; - while((flow->packet.payload[off] != '\0')) + while(flow->packet.payload[off] != '\0' && off < flow->packet.payload_packet_len) { - if(off < flow->packet.payload_packet_len) - { flow->host_server_name[j] = flow->packet.payload[off]; if(j < strlen((char*)flow->host_server_name)) { if(flow->host_server_name[j] < ' ') @@ -123,7 +121,6 @@ void ndpi_search_dns(struct ndpi_detection_module_struct *ndpi_struct, struct nd j++; } off++; - } } flow->host_server_name[j] = '\0'; |