This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[perl #42844] careless use of gethostbyname() in Socket.xs
authorkan@dcit.cz <kan@dcit.cz>
Tue, 1 May 2007 09:17:22 +0000 (02:17 -0700)
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>
Fri, 4 May 2007 14:02:26 +0000 (14:02 +0000)
From: kan@dcit.cz (via RT) <perlbug-followup@perl.org>
Message-ID: <rt-3.6.HEAD-6655-1178036242-364.42844-75-0@perl.org>

p4raw-id: //depot/perl@31138

ext/Socket/Socket.pm
ext/Socket/Socket.xs

index bb05349..47b27e7 100644 (file)
@@ -1,7 +1,7 @@
 package Socket;
 
 our($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS);
-$VERSION = "1.78";
+$VERSION = "1.79";
 
 =head1 NAME
 
index 48f30d9..f86c5ae 100644 (file)
@@ -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;
        }