changeset 36260:a2750366a255

stream/tcp: Check that host object has the right AF before connect Avoid trying bogus IPv6 adresses on systems that only have gethostbyname function. Currently we would copy the IPv4 address into the first part of the IPv6 and then try to connect to that. The connection attempt can take a long time. Tested-by: Erik Auerswald >auerswal unix-ag uni-kl de< Patch-by: >aplattner nvidia com<
author al
date Thu, 11 Jul 2013 22:08:33 +0000
parents c5b20369f0be
children ca1d4a7bb751
files stream/tcp.c
diffstat 1 files changed, 2 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/stream/tcp.c	Thu Jul 11 15:27:32 2013 +0000
+++ b/stream/tcp.c	Thu Jul 11 22:08:33 2013 +0000
@@ -160,6 +160,8 @@
 			return TCP_ERROR_FATAL;
 		}
 
+		if (af != hp->h_addrtype) return TCP_ERROR_FATAL;
+
 		memcpy( our_s_addr, hp->h_addr_list[0], hp->h_length );
 	}
 #if HAVE_WINSOCK2_H