Skip to content

Commit 6a42402

Browse files
committed
Don't trust result of gethostbyaddr(INADDR_LOOPBACK) [RT#67247]
1 parent 8ecd3d7 commit 6a42402

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

lib/HTTP/Daemon.pm

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use vars qw($VERSION @ISA $PROTO $DEBUG);
55

66
$VERSION = "6.00";
77

8-
use IO::Socket qw(AF_INET INADDR_ANY inet_ntoa);
8+
use IO::Socket qw(AF_INET INADDR_ANY INADDR_LOOPBACK inet_ntoa);
99
@ISA=qw(IO::Socket::INET);
1010

1111
$PROTO = "HTTP/1.1";
@@ -44,6 +44,9 @@ sub url
4444
require Sys::Hostname;
4545
$url .= lc Sys::Hostname::hostname();
4646
}
47+
elsif ($addr eq INADDR_LOOPBACK) {
48+
$url .= inet_ntoa($addr);
49+
}
4750
else {
4851
$url .= gethostbyaddr($addr, AF_INET) || inet_ntoa($addr);
4952
}

0 commit comments

Comments
 (0)