From 2fb6f317d6608f6f49ee53ab996648312719ef42 Mon Sep 17 00:00:00 2001 From: terrafrost Date: Tue, 6 Feb 2024 04:29:25 -0600 Subject: [PATCH] SSH2: set stream timeout before calling stream_get_contents --- phpseclib/Net/SSH2.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/phpseclib/Net/SSH2.php b/phpseclib/Net/SSH2.php index 1c459672..688c0ac6 100644 --- a/phpseclib/Net/SSH2.php +++ b/phpseclib/Net/SSH2.php @@ -3646,6 +3646,9 @@ class SSH2 } $start = microtime(true); + $sec = (int) floor($this->curTimeout); + $usec = (int) (1000000 * ($this->curTimeout - $sec)); + stream_set_timeout($this->fsock, $sec, $usec); $raw = stream_get_contents($this->fsock, $this->decrypt_block_size); if (!strlen($raw)) {