From 8c9e7a890e5755ee27fca66590ff5d2fa0616e56 Mon Sep 17 00:00:00 2001 From: terrafrost Date: Mon, 22 Jul 2013 23:48:28 -0500 Subject: [PATCH] SSH2: more window size adjustments --- phpseclib/Net/SSH2.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/phpseclib/Net/SSH2.php b/phpseclib/Net/SSH2.php index fe562d99..90c81d0d 100644 --- a/phpseclib/Net/SSH2.php +++ b/phpseclib/Net/SSH2.php @@ -2941,7 +2941,7 @@ class Net_SSH2 { $max_size = min( $this->packet_size_client_to_server[$client_channel], $this->window_size_client_to_server[$client_channel] - ); + ) - 4; while (strlen($data) > $max_size) { $packet = pack('CN2a*', NET_SSH2_MSG_CHANNEL_DATA, @@ -2956,7 +2956,7 @@ class Net_SSH2 { return false; } - if ($max_size == $this->window_size_client_to_server[$client_channel]) { + if ($max_size == $this->window_size_client_to_server[$client_channel] - 4) { $this->bitmap^= NET_SSH2_MASK_WINDOW_ADJUST; // using an invalid channel will let the buffers be built up for the valid channels $this->_get_channel_packet(-1); @@ -2964,11 +2964,11 @@ class Net_SSH2 { $max_size = min( $this->packet_size_client_to_server[$client_channel], $this->window_size_client_to_server[$client_channel] - ); + ) - 4; } } - if (strlen($data) >= $this->window_size_client_to_server[$client_channel]) { + if (strlen($data) >= $this->window_size_client_to_server[$client_channel] - 4) { $this->bitmap^= NET_SSH2_MASK_WINDOW_ADJUST; $this->_get_channel_packet(-1); $this->bitmap^= NET_SSH2_MASK_WINDOW_ADJUST;