summaryrefslogtreecommitdiffstats
path: root/main/libc0.9.32/uclibc-resolv-fix.patch
blob: afde80df3da63b05a5e600507769412c50025706 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
diff --git a/libc/inet/resolv.c b/libc/inet/resolv.c
index 84289a6..84a6b41 100644
--- a/libc/inet/resolv.c
+++ b/libc/inet/resolv.c
@@ -689,7 +689,7 @@ int attribute_hidden __decode_dotted(const unsigned char *packet,
 
 		if (used + b + 1 >= dest_len)
 			return -1;
-		if (offset + b + 1 >= packet_len)
+		if (offset + b >= packet_len)
 			return -1;
 		memcpy(dest + used, packet + offset, b);
 		offset += b;
@@ -2456,7 +2456,7 @@ int gethostbyaddr_r(const void *addr, socklen_t addrlen,
 		char *dst = buf;
 		unsigned char *tp = (unsigned char *)addr + addrlen - 1;
 		do {
-			dst += sprintf(dst, "%x.%x.", tp[i] & 0xf, tp[i] >> 4);
+			dst += sprintf(dst, "%x.%x.", tp[0] & 0xf, tp[0] >> 4);
 			tp--;
 		} while (tp >= (unsigned char *)addr);
 		strcpy(dst, "ip6.arpa");