From: Dirk Koopman Date: Sat, 23 May 2020 15:30:36 +0000 (+0100) Subject: fix DXSubcommand thaw protection X-Git-Url: http://dxcluster.net/gitweb/gitweb.cgi?a=commitdiff_plain;h=04f1823a3dc3f20b6bbcaeee89b3b09e26d91f6d;p=spider.git fix DXSubcommand thaw protection --- diff --git a/perl/DXSubprocess.pm b/perl/DXSubprocess.pm index 6ff5adae..e9624c7d 100644 --- a/perl/DXSubprocess.pm +++ b/perl/DXSubprocess.pm @@ -29,7 +29,7 @@ sub freeze my $j = shift; unless ($j) { LogDbg('DXUser', "DXSubcommand::freeze: undefined or empty input"); - return q{[null, ""]}; + return q{[null, '']}; } eval { $r = encode_json($j) }; @@ -47,14 +47,14 @@ sub thaw my $j = shift; unless ($j) { LogDbg('DXUser', "DXSubcommand::thaw: empty string on input"); - return q{[null, ""]}; + return [undef,[0]]; } return [undef, [1]] unless $j; eval { $r = decode_json($j) }; if ($@) { LogDbg('DXUser', "DXSubcommand::thaw: json error on '$j': $@"); - $r = qq{[$@,[1]]}; + $r = [$@,[0]]; } return $r; } diff --git a/perl/Msg.pm b/perl/Msg.pm index 9e7a03a1..9b7ce76f 100644 --- a/perl/Msg.pm +++ b/perl/Msg.pm @@ -482,7 +482,7 @@ sub new_client { $sock->on(read => sub {$conn->_rcv($_[1])}); $sock->timeout(0); $sock->start; - $conn->{peerhost} = $handle->peerhost; + $conn->{peerhost} = $handle->peerhost || 'unknown'; $conn->{peerhost} =~ s|^::ffff:||; # chop off leading pseudo IPV6 stuff on dual stack listeners $conn->{peerport} = $handle->peerport || 0; dbg((ref $conn) . " accept $conn->{cnum} from $conn->{peerhost}:$conn->{peerport}") if isdbg('conn') || isdbg('connect');