]> dxcluster.net Git - spider.git/commitdiff
fix DXSubcommand thaw protection
authorDirk Koopman <djk@tobit.co.uk>
Sat, 23 May 2020 15:30:36 +0000 (16:30 +0100)
committerDirk Koopman <djk@tobit.co.uk>
Sat, 23 May 2020 23:00:32 +0000 (00:00 +0100)
perl/DXSubprocess.pm
perl/Msg.pm

index 6ff5adae1bbba143f2531007359e19bd31ed9a09..e9624c7d8da4bebd0c961e7563f2ea084add4813 100644 (file)
@@ -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;
 }
index 9e7a03a1da59af184231ff4d675f46aab5c641ef..9b7ce76fd9e32091f9b7b858f252b6f4185e7fab 100644 (file)
@@ -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');