summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2011-06-17 20:27:51 +0200
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2011-06-29 19:23:51 +0200
commitf27a6d9125c7e93f2f38a23fba04395527bfd02a (patch)
tree6ea247b156377806662ba34229382a99845e62bc
parent13b1676e5d89ae7fbac4fc4d26c3ac26cb6e2439 (diff)
downloaduClibc-alpine-f27a6d9125c7e93f2f38a23fba04395527bfd02a.tar.bz2
uClibc-alpine-f27a6d9125c7e93f2f38a23fba04395527bfd02a.tar.xz
resolv: fix bug in res_init with ipv6 nameservers
Thanks to Christian Krause <chkr plauener.de> for finding and fixing this! Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
-rw-r--r--libc/inet/resolv.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libc/inet/resolv.c b/libc/inet/resolv.c
index e8b7f2bad..dc8a752fa 100644
--- a/libc/inet/resolv.c
+++ b/libc/inet/resolv.c
@@ -2964,7 +2964,7 @@ int res_init(void)
if (__nameserver[i].sa.sa_family == AF_INET6
&& m < ARRAY_SIZE(rp->_u._ext.nsaddrs)
) {
- struct sockaddr_in6 *sa6 = malloc(sizeof(sa6));
+ struct sockaddr_in6 *sa6 = malloc(sizeof(*sa6));
if (sa6) {
*sa6 = __nameserver[i].sa6; /* struct copy */
rp->_u._ext.nsaddrs[m] = sa6;
@@ -2981,7 +2981,7 @@ int res_init(void)
#else /* IPv6 only */
while (m < ARRAY_SIZE(rp->_u._ext.nsaddrs) && i < __nameservers) {
- struct sockaddr_in6 *sa6 = malloc(sizeof(sa6));
+ struct sockaddr_in6 *sa6 = malloc(sizeof(*sa6));
if (sa6) {
*sa6 = __nameserver[i].sa6; /* struct copy */
rp->_u._ext.nsaddrs[m] = sa6;