diff --git a/sys/net/application_layer/dns/dns.c b/sys/net/application_layer/dns/dns.c index 639b30f5113cd2bb8a4d1250a763e83a69007c12..cf82e10a8321f658af8fbc6385735391889796c7 100644 --- a/sys/net/application_layer/dns/dns.c +++ b/sys/net/application_layer/dns/dns.c @@ -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; } } }