summaryrefslogtreecommitdiff
path: root/ext/Socket
diff options
context:
space:
mode:
authorkan@dcit.cz <kan@dcit.cz>2007-05-01 02:17:22 -0700
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2007-05-04 14:02:26 +0000
commit2130c338900859fde94b9dea84a75b8d51a34d46 (patch)
tree5348495641f40a97eb0ded0b3820fada4dbed94e /ext/Socket
parent2bc0d02221944074d33eee1f274902f3f414b9a1 (diff)
downloadperl-2130c338900859fde94b9dea84a75b8d51a34d46.tar.gz
[perl #42844] careless use of gethostbyname() in Socket.xs
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
Diffstat (limited to 'ext/Socket')
-rw-r--r--ext/Socket/Socket.pm2
-rw-r--r--ext/Socket/Socket.xs3
2 files changed, 3 insertions, 2 deletions
diff --git a/ext/Socket/Socket.pm b/ext/Socket/Socket.pm
index bb053490e8..47b27e753f 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 48f30d902d..f86c5aefa6 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;
}