[git commit] resolv: fix bug in res_init with ipv6 nameservers

Bernhard Reutner-Fischer rep.dot.nop at gmail.com
Fri Jun 17 18:27:51 UTC 2011


commit: http://git.uclibc.org/uClibc/commit/?id=e8dc8eca8d312a717dc94f9783af212aed388c11
branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/master

Thanks to Christian Krause <chkr plauener.de> for finding and fixing
this!

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop at gmail.com>
---
 libc/inet/resolv.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libc/inet/resolv.c b/libc/inet/resolv.c
index e8b7f2b..dc8a752 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;
-- 
1.7.3.4



More information about the uClibc-cvs mailing list