diff options
author | Sorin Zamfir <zamfir.sorin@yahoo.com> | 2016-04-03 14:45:08 +0300 |
---|---|---|
committer | srz <srz@melcu.org> | 2016-04-03 14:45:39 +0300 |
commit | 7b66fcff37608786fa4484f75717f7641d920c6b (patch) | |
tree | 9d1fbc9148325397c289a85d50fa5d5099b57e10 /src/lib/protocols/dns.c | |
parent | 40b219c397c31ae2a2081c670e7daa9894ea31d1 (diff) | |
parent | aa86387ba949ba70c4791e9df68bcf47fdc4a286 (diff) |
Merge remote-tracking branch 'upstream/dev' into dev
Diffstat (limited to 'src/lib/protocols/dns.c')
-rw-r--r-- | src/lib/protocols/dns.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/lib/protocols/dns.c b/src/lib/protocols/dns.c index c975465ea..503761137 100644 --- a/src/lib/protocols/dns.c +++ b/src/lib/protocols/dns.c @@ -114,11 +114,17 @@ void ndpi_search_dns(struct ndpi_detection_module_struct *ndpi_struct, struct nd int off = sizeof(struct ndpi_dns_packet_header) + 1; while((flow->packet.payload[off] != '\0')) { - flow->host_server_name[j] = flow->packet.payload[off]; - if(flow->host_server_name[j] < ' ') - flow->host_server_name[j] = '.'; - off++; - j++; + if(off < flow->packet.payload_packet_len) + { + flow->host_server_name[j] = flow->packet.payload[off]; + if(j < strlen(flow->host_server_name)) + { + if(flow->host_server_name[j] < ' ') + flow->host_server_name[j] = '.'; + j++; + } + off++; + } } flow->host_server_name[j] = '\0'; |