abort the reply parsing if an error is encountered
authorJohn Crispin <blogic@openwrt.org>
Wed, 27 Aug 2014 16:10:20 +0000 (18:10 +0200)
committerJohn Crispin <blogic@openwrt.org>
Wed, 27 Aug 2014 16:26:09 +0000 (18:26 +0200)
Signed-off-by: John Crispin <blogic@openwrt.org>
dns.c

diff --git a/dns.c b/dns.c
index ebef9ce..585b40f 100644 (file)
--- a/dns.c
+++ b/dns.c
@@ -380,11 +380,15 @@ dns_handle_packet(struct interface *iface, uint8_t *buffer, int len)
                return;
 
        while (h->answers-- > 0)
                return;
 
        while (h->answers-- > 0)
-               parse_answer(iface, buffer, len, &b, &rlen, 1);
+               if (parse_answer(iface, buffer, len, &b, &rlen, 1))
+                       return;
 
        while (h->authority-- > 0)
 
        while (h->authority-- > 0)
-               parse_answer(iface, buffer, len, &b, &rlen, 0);
+               if (parse_answer(iface, buffer, len, &b, &rlen, 1))
+                       return;
 
        while (h->additional-- > 0)
 
        while (h->additional-- > 0)
-               parse_answer(iface, buffer, len, &b, &rlen, 1);
+               if (parse_answer(iface, buffer, len, &b, &rlen, 1))
+                       return;
+
 }
 }