aboutsummaryrefslogtreecommitdiffstats
path: root/main/libc0.9.32/uclibc-resolv-cname-fix.diff
blob: cf5e777f7e9a98c7514717e615f9dd530539c791 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
diff --git a/libc/inet/resolv.c b/libc/inet/resolv.c
index 1e394d4..03d68fe 100644
--- a/libc/inet/resolv.c
+++ b/libc/inet/resolv.c
@@ -3099,11 +3099,9 @@ 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);
-	}
+	i = MIN(anslen, i);
+	memcpy(answer, packet, i);
+
 	free(packet);
 	return i;
 }