From: Dirk Koopman Date: Sat, 23 May 2020 15:30:36 +0000 (+0100) Subject: fix DXSubcommand thaw protection X-Git-Url: http://dxcluster.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=677f9d4ae7355cb6e5d05c3782a39e9022647f5b;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 5e40d3c2..9ea2bc10 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; dbg((ref $conn) . " accept $conn->{cnum} from $conn->{peerhost}:$conn->{peerport}") if isdbg('conn') || isdbg('connect');