[PATCH] res_query: fix for CNAME responses on A queries.

Natanael Copa natanael.copa at gmail.com
Fri Nov 27 12:31:41 UTC 2009


This fixes an issue when a CNAME was returned for an A query.
Garbage was returned.

Postfix was affected of this.

Signed-off-by: Natanael Copa <natanael.copa at gmail.com>
---
 libc/inet/resolv.c |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/libc/inet/resolv.c b/libc/inet/resolv.c
index e6dac1a..0eb59f3 100644
--- a/libc/inet/resolv.c
+++ b/libc/inet/resolv.c
@@ -1604,11 +1604,10 @@ int res_query(const char *dname, int class, int type,
 
 	free(a.dotted);
 
-	if (a.atype == type) { /* CNAME */
-		if (i > anslen)
-			i = anslen;
-		memcpy(answer, packet, i);
-	}
+	if (i > anslen)
+		i = anslen;
+	memcpy(answer, packet, i);
+
 	free(packet);
 	return i;
 }
-- 
1.6.5.2



More information about the uClibc mailing list