diff --git a/phpseclib/Net/SCP.php b/phpseclib/Net/SCP.php index 9e48c479..0e0e946c 100644 --- a/phpseclib/Net/SCP.php +++ b/phpseclib/Net/SCP.php @@ -283,6 +283,13 @@ class Net_SCP $content = ''; while ($size < $info['size']) { $data = $this->_receive(); + + // Terminate the loop in case the server repeatedly sends an empty response + if ($data === false) { + user_error('No data received from server', E_USER_NOTICE); + return false; + } + // SCP usually seems to split stuff out into 16k chunks $size+= strlen($data);