Skip to content
Snippets Groups Projects
Commit b30cdb51 authored by Martine Lenders's avatar Martine Lenders
Browse files

sock_dns: correctly report too short messages

parent 782b181b
No related branches found
No related tags found
No related merge requests found
...@@ -221,9 +221,15 @@ int sock_dns_query(const char *domain_name, void *addr_out, int family) ...@@ -221,9 +221,15 @@ 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) {
goto out; if ((res = _parse_dns_reply(reply_buf, res, addr_out,
family)) > 0) {
goto out;
}
}
else {
res = -EBADMSG;
} }
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment