From 68c3eef88f14f1b4002270cdf90aedf764e21577 Mon Sep 17 00:00:00 2001 From: terrafrost Date: Mon, 28 Nov 2022 08:42:55 -0600 Subject: [PATCH] SCP: do $var === false vs !$var --- phpseclib/Net/SCP.php | 7 +++++++ 1 file changed, 7 insertions(+) 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);