check error returned by dns_decode

before this commit, sending "GET / HTTP/1.1" to server will cause uninitialized variable access.
This commit is contained in:
chengzhicn 2017-10-13 03:08:12 +08:00 committed by GitHub
parent 006ffa619e
commit 122ac1a25d
1 changed files with 1 additions and 1 deletions

View File

@ -2068,7 +2068,7 @@ read_dns(int fd, struct dnsfd *dns_fds, int tun_fd, struct query *q)
if (raw_decode(packet, r, q, fd, dns_fds, tun_fd)) {
return 0;
}
if (dns_decode(NULL, 0, q, QR_QUERY, packet, r) < 0) {
if (dns_decode(NULL, 0, q, QR_QUERY, packet, r) <= 0) {
return 0;
}