diff --git a/phpseclib/Net/SCP.php b/phpseclib/Net/SCP.php index cf13496c..ee6e1c9d 100644 --- a/phpseclib/Net/SCP.php +++ b/phpseclib/Net/SCP.php @@ -247,6 +247,13 @@ class 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);