mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-18 12:52:44 +01:00
Merge pull request #10896 from miri64/sock_dns/fix/too-small-msg-error
sock_dns: correctly report too short messages
This commit is contained in:
commit
1481239bdf
@ -221,9 +221,15 @@ int sock_dns_query(const char *domain_name, void *addr_out, int family)
|
||||
continue;
|
||||
}
|
||||
res = sock_udp_recv(&sock_dns, reply_buf, sizeof(reply_buf), 1000000LU, NULL);
|
||||
if ((res > 0) && (res > (int)DNS_MIN_REPLY_LEN)) {
|
||||
if ((res = _parse_dns_reply(reply_buf, res, addr_out, family)) > 0) {
|
||||
goto out;
|
||||
if (res > 0) {
|
||||
if (res > (int)DNS_MIN_REPLY_LEN) {
|
||||
if ((res = _parse_dns_reply(reply_buf, res, addr_out,
|
||||
family)) > 0) {
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
else {
|
||||
res = -EBADMSG;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user