From: kan@dcit.cz Date: Tue, 1 May 2007 09:17:22 +0000 (-0700) Subject: [perl #42844] careless use of gethostbyname() in Socket.xs X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=2130c338900859fde94b9dea84a75b8d51a34d46;p=p5sagit%2Fp5-mst-13.2.git [perl #42844] careless use of gethostbyname() in Socket.xs From: kan@dcit.cz (via RT) Message-ID: p4raw-id: //depot/perl@31138 --- diff --git a/ext/Socket/Socket.pm b/ext/Socket/Socket.pm index bb05349..47b27e7 100644 --- a/ext/Socket/Socket.pm +++ b/ext/Socket/Socket.pm @@ -1,7 +1,7 @@ package Socket; our($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS); -$VERSION = "1.78"; +$VERSION = "1.79"; =head1 NAME diff --git a/ext/Socket/Socket.xs b/ext/Socket/Socket.xs index 48f30d9..f86c5ae 100644 --- a/ext/Socket/Socket.xs +++ b/ext/Socket/Socket.xs @@ -233,7 +233,8 @@ inet_aton(host) struct hostent * phe; int ok = (*host != '\0') && inet_aton(host, &ip_address); - if (!ok && (phe = gethostbyname(host))) { + if (!ok && (phe = gethostbyname(host)) && + phe->h_addrtype == AF_INET && phe->h_length == 4) { Copy( phe->h_addr, &ip_address, phe->h_length, char ); ok = 1; }