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 7, 2024
1 parent 498e67a commit 2fb6f31
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions phpseclib/Net/SSH2.php
Expand Up @@ -3646,6 +3646,9 @@ 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

1 comment on commit 2fb6f31

@terrafrost
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #1977

Please sign in to comment.