Subject: | sockhostname called on literal $addr instead of $self crashes HTTP::Daemon-6.0.1 |
Date: | Mon, 30 Apr 2018 14:30:51 +0200 |
To: | bug-HTTP-Daemon [...] rt.cpan.org |
From: | Markus Wernig <markus [...] wernig.net> |
Hi all
A bug seems to have slipped in with the patch to move from
IO::Socket::INET to ::IP (Extend IO::Socket::IP to replace ::INET -
https://rt.cpan.org/Public/Bug/Display.html?id=91699).
In sub url, line 64, the "sockhostname" method is called on the result
($addr) of $self->sockaddr (called on line 52). But $addr is not a class
object, but a binary string, so this must fail, and actually does with
this error:
Can't call method "sockhostname" without a package or object reference
at /usr/share/perl5/vendor_perl/HTTP/Daemon.pm line 64.
The following patch fixes this:
--- Daemon.pm.dist 2018-04-30 09:31:17.902832206 +0200
+++ Daemon.pm 2018-04-30 14:17:47.502075060 +0200
@@ -61,7 +61,7 @@
$url .= '[' . inet_ntop(AF_INET6, $addr) . ']';
}
else {
- my $host = $addr->sockhostname;
+ my $host = $self->sockhostname;
if (!defined $host) {
if (sockaddr_family($addr) eq AF_INET6) {
$host = '[' . inet_ntop(AF_INET6, $addr) . ']';
Noticed this on CentOS, after upgrading from
perl-HTTP-Daemon-6.01-5.el7.noarch to
perl-HTTP-Daemon-6.01-7.el7.noarch. Both Daemon.pm files report
$VERSION="6.01", but the one from 5.el7 ISA IO::Socket::INET, while the
other one ISA IO::Socket::IP.
Regards
/markus
--
Markus Wernig
Unix/Network Security Engineer
PGP: D9203D2A4AD9FC3333DEEF9DF7ACC6208E82E4DC
SIP/XMPP: markus@wernig.net
Furch D25-SR Cut - Ovation CE C2078AX-5
-------------------------------------------
https://xfer.ch - https://markus.wernig.net
-------------------------------------------
Message body not shown because it is not plain text.