Skip DNS TCP length

This commit is contained in:
M66B 2019-04-19 07:52:36 +02:00
parent daabaab4ba
commit 467a74a464
1 changed files with 4 additions and 2 deletions

View File

@ -585,8 +585,10 @@ void check_tcp_socket(const struct arguments *args,
s->tcp.received += bytes;
// Process DNS response
if (ntohs(s->tcp.dest) == 53)
parse_dns_response(args, s, buffer, (size_t *) &bytes);
if (ntohs(s->tcp.dest) == 53 && bytes > 2) {
ssize_t dlen = bytes - 2;
parse_dns_response(args, s, buffer + 2, (size_t *) &dlen);
}
// Forward to tun
if (write_data(args, &s->tcp, buffer, (size_t) bytes) >= 0) {