sock_dns: correctly report too short messages
This commit is contained in:
parent
782b181b63
commit
b30cdb51a5
@ -221,11 +221,17 @@ int sock_dns_query(const char *domain_name, void *addr_out, int family)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
res = sock_udp_recv(&sock_dns, reply_buf, sizeof(reply_buf), 1000000LU, NULL);
|
res = sock_udp_recv(&sock_dns, reply_buf, sizeof(reply_buf), 1000000LU, NULL);
|
||||||
if ((res > 0) && (res > (int)DNS_MIN_REPLY_LEN)) {
|
if (res > 0) {
|
||||||
if ((res = _parse_dns_reply(reply_buf, res, addr_out, family)) > 0) {
|
if (res > (int)DNS_MIN_REPLY_LEN) {
|
||||||
|
if ((res = _parse_dns_reply(reply_buf, res, addr_out,
|
||||||
|
family)) > 0) {
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
res = -EBADMSG;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
out:
|
out:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user