Bläddra i källkod

fix obvious bug in ipv4/ipv6 resolving. When not using AF_INET,
gethostbyname2_r tries to resolve an ipv6 address from /etc/hosts using
get_hosts_byname_r, but with AF_INET instead of the supplied address family.
This returns ipv4 addresses marked as ipv6 ones. Fix from nbd.

Eric Andersen 18 år sedan
förälder
incheckning
9af4b40d38
1 ändrade filer med 1 tillägg och 1 borttagningar
  1. 1 1
      libc/inet/resolv.c

+ 1 - 1
libc/inet/resolv.c

@@ -2130,7 +2130,7 @@ int gethostbyname2_r(const char *name, int family,
 		int old_errno = errno;	/* Save the old errno and reset errno */
 		__set_errno(0);			/* to check for missing /etc/hosts. */
 
-		if ((i=__get_hosts_byname_r(name, AF_INET, result_buf,
+		if ((i=__get_hosts_byname_r(name, family, result_buf,
 									buf, buflen, result, h_errnop))==0)
 			return i;
 		switch (*h_errnop) {