From c20dd784f01196b9ae9fd8281b374515da458b98 Mon Sep 17 00:00:00 2001 From: terrafrost Date: Wed, 28 Feb 2024 22:40:13 -0600 Subject: [PATCH] SSH2: don't set stream timeout if timeout is 0 --- phpseclib/Net/SSH2.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/phpseclib/Net/SSH2.php b/phpseclib/Net/SSH2.php index 589dfec8..eee2e108 100644 --- a/phpseclib/Net/SSH2.php +++ b/phpseclib/Net/SSH2.php @@ -3561,9 +3561,11 @@ class SSH2 } $start = microtime(true); - $sec = (int) floor($this->curTimeout); - $usec = (int) (1000000 * ($this->curTimeout - $sec)); - stream_set_timeout($this->fsock, $sec, $usec); + if ($this->curTimeout) { + $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)) {