Chris Luke wrote (on Sun 08 Jul, 2012 at 21:48 BST):
I've also sent this upstream, https://bugs.busybox.net/show_bug.cgi?id=5342
but I don't know how long it takes for fixes to filter down.

And this time I'll not word-wrap the patch. Duhh.

toolchain/uClibc/patches-0.9.33.2/510-resolv-any.patch

Fixes erroneous rejection of T_ANY and T_CNAME DNS queries by res_query() in 
the uClibc resolver.
Fixes error indication when res_query() does reject a response.

Signed-off-by: Chris Luke <chr...@flirble.org>

Index: uClibc-0.9.33.2/libc/inet/resolv.c
===================================================================
--- uClibc-0.9.33.2.orig/libc/inet/resolv.c     2012-07-07 11:05:29.931149126 
-0400
+++ uClibc-0.9.33.2/libc/inet/resolv.c  2012-07-07 11:06:17.375149135 -0400
@@ -3741,10 +3741,16 @@
free(a.dotted); - if (a.atype == type) { /* CNAME */
+       /* Copy the answer only if the type asked for is the same as the answer,
+        * we asked for T_ANY, or an A or AAAA returned a CNAME first.
+        */
+       if (a.atype == type || type == T_ANY || (a.atype == T_CNAME && (type == 
T_A || type == T_AAAA))) {
                if (i > anslen)
                        i = anslen;
                memcpy(answer, packet, i);
+       } else {
+               h_errno = NO_DATA;
+               i = -1;
        }
        free(packet);
        return i;


_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to