aboutsummaryrefslogtreecommitdiff
path: root/libc/inet/resolv.c
diff options
context:
space:
mode:
authorGravatar Mike Frysinger <vapier@gentoo.org>2007-01-26 00:01:55 +0000
committerGravatar Mike Frysinger <vapier@gentoo.org>2007-01-26 00:01:55 +0000
commit4253551cbbf0e9a040f03325242f96a5aa566738 (patch)
tree73ce09609c3a4341a3e7fb64bcd53559351650c6 /libc/inet/resolv.c
parentacb14559eb597903baaa2d42dd4ec7354d263883 (diff)
downloaduClibc-4253551cbbf0e9a040f03325242f96a5aa566738.tar.gz
uClibc-4253551cbbf0e9a040f03325242f96a5aa566738.tar.bz2
pull accumulated fixes from trunk
Diffstat (limited to 'libc/inet/resolv.c')
-rw-r--r--libc/inet/resolv.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/libc/inet/resolv.c b/libc/inet/resolv.c
index 27b60efea..0312b2ca3 100644
--- a/libc/inet/resolv.c
+++ b/libc/inet/resolv.c
@@ -2204,6 +2204,7 @@ int gethostbyaddr_r (const void *addr, socklen_t len, int type,
struct in6_addr *in6;
struct in6_addr **addr_list6;
#endif /* __UCLIBC_HAS_IPV6__ */
+ char **alias;
unsigned char *packet;
struct resolv_answer a;
int i;
@@ -2264,6 +2265,12 @@ int gethostbyaddr_r (const void *addr, socklen_t len, int type,
buf+=sizeof(*addr_list)*2;
buflen-=sizeof(*addr_list)*2;
+ if (buflen < sizeof(char *)*(ALIAS_DIM))
+ return ERANGE;
+ alias=(char **)buf;
+ buf+=sizeof(*alias)*(ALIAS_DIM);
+ buflen-=sizeof(*alias)*(ALIAS_DIM);
+
#ifdef __UCLIBC_HAS_IPV6__
if (plen < sizeof(*in6))
return ERANGE;
@@ -2312,6 +2319,9 @@ int gethostbyaddr_r (const void *addr, socklen_t len, int type,
addr_list[1] = 0;
+ alias[0] = buf;
+ alias[1] = 0;
+
for (;;) {
BIGLOCK;
@@ -2358,6 +2368,7 @@ int gethostbyaddr_r (const void *addr, socklen_t len, int type,
}
result_buf->h_addr_list = (char **) addr_list;
+ result_buf->h_aliases = alias;
break;
} else {
free(packet);