migrate: insecure: untaint the received ip/port
This commit is contained in:
committed by
Dietmar Maurer
parent
47cea19432
commit
488cf14d4f
@ -671,9 +671,8 @@ sub storage_migrate {
|
|||||||
if ($insecure) {
|
if ($insecure) {
|
||||||
my $pid = open(my $info, '-|', @$recv)
|
my $pid = open(my $info, '-|', @$recv)
|
||||||
or die "receive command failed: $!\n";
|
or die "receive command failed: $!\n";
|
||||||
my $ip = <$info> // die "no tunnel IP received\n";
|
my ($ip) = <$info> =~ /^($PVE::Tools::IPRE)$/ or die "no tunnel IP received\n";
|
||||||
my $port = <$info> // die "no tunnel port received\n";
|
my ($port) = <$info> =~ /^(\d+)$/ or die "no tunnel port received\n";
|
||||||
chomp($ip, $port);
|
|
||||||
my $socket = IO::Socket::IP->new(PeerHost => $ip, PeerPort => $port, Type => SOCK_STREAM)
|
my $socket = IO::Socket::IP->new(PeerHost => $ip, PeerPort => $port, Type => SOCK_STREAM)
|
||||||
or die "failed to connect to tunnel at $ip:$port\n";
|
or die "failed to connect to tunnel at $ip:$port\n";
|
||||||
run_command([$send, @cstream], output => '>&'.fileno($socket));
|
run_command([$send, @cstream], output => '>&'.fileno($socket));
|
||||||
|
|||||||
Reference in New Issue
Block a user