Skip to content

Commit

Permalink
SSH2: set stream timeout before calling stream_get_contents
Browse files Browse the repository at this point in the history
  • Loading branch information
terrafrost committed Feb 6, 2024
1 parent 6a6c222 commit 4cadfb6
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions phpseclib/Net/SSH2.php
Expand Up @@ -3531,6 +3531,9 @@ private function get_binary_packet($skip_channel_filter = false)
}

$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)) {
Expand Down

0 comments on commit 4cadfb6

Please sign in to comment.