Permalink
Browse files

getnameinfo() returns host and port in the opposite order of

unpack_sockaddr_in().  Swap the return values so the right ones appear
in ARG1 and ARG2.  Thanks to Luiz Eduardo Roncato Cordeiro at CERT
Brazil for spotting the problem and suggesting the fix.  This should
resolve his rt.cpan.org ticket, #68959.
  • Loading branch information...
1 parent 1589bc5 commit 32db4fe99932c3d69b3f3ca96b8463f2f4fe4b05 @rcaputo committed Jul 27, 2011
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/POE/Wheel/SocketFactory.pm
@@ -189,7 +189,7 @@ sub _define_accept_state {
}
elsif ( $domain eq DOM_INET6 ) {
$peer = getpeername($new_socket);
- ((my $error), $peer_port, $peer_addr) = getnameinfo($peer);
+ ((my $error), $peer_addr, $peer_port) = getnameinfo($peer);
warn $error if $error;
}
else {
@@ -309,7 +309,7 @@ sub _define_connect_state {
# INET6 socket stacks tend not to.
elsif ($domain eq DOM_INET6) {
if (defined $peer) {
- ((my $error), $peer_port, $peer_addr) = getnameinfo($peer);
+ ((my $error), $peer_addr, $peer_port) = getnameinfo($peer);
if ($error) {
warn $error;
$peer_port = $peer_addr = undef;

0 comments on commit 32db4fe

Please sign in to comment.