[riot-notifications] [RIOT-OS/RIOT] sock_dns: correctly report too short messages (#10896)

Martine Lenders notifications at github.com
Tue Jan 29 20:38:51 CET 2019


miri64 commented on this pull request.



> @@ -221,8 +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) {
+        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;
                 goto out;

You are right. Will fix.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/10896#discussion_r251986814
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190129/4b697c8c/attachment.html>


More information about the notifications mailing list