summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@digia.com>2014-09-11 12:33:45 +0200
committerChristian Kandeler <christian.kandeler@digia.com>2014-09-11 12:35:32 +0200
commit38ffff88da1f0e1b2aa6e6439d6324f717f83191 (patch)
treed591c5d547011a6361ba49c35bc1048c5e5a3485
parent060c5db5d31f96b5062cba0d324faacc2a87c84b (diff)
downloadqt-creator-38ffff88da1f0e1b2aa6e6439d6324f717f83191.tar.gz
SSH: Fix maximum packet size check.
The statement in the RFC was misunderstood. Task-number: QTCREATORBUG-12884 Change-Id: Icd533362ebf95d963cacc8d11da03360e742f070 Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
-rw-r--r--src/libs/ssh/sshchannel.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/libs/ssh/sshchannel.cpp b/src/libs/ssh/sshchannel.cpp
index a2595aa88d..41db221624 100644
--- a/src/libs/ssh/sshchannel.cpp
+++ b/src/libs/ssh/sshchannel.cpp
@@ -39,7 +39,10 @@
namespace QSsh {
namespace Internal {
-const quint32 MinMaxPacketSize = 32768;
+// "Payload length" (RFC 4253, 6.1), i.e. minus packet type, channel number
+// and length field for string.
+const quint32 MinMaxPacketSize = 32768 - sizeof(quint32) - sizeof(quint32) - 1;
+
const quint32 NoChannel = 0xffffffffu;
AbstractSshChannel::AbstractSshChannel(quint32 channelId,
@@ -151,8 +154,7 @@ void AbstractSshChannel::handleOpenSuccess(quint32 remoteChannelId,
#endif
m_remoteChannel = remoteChannelId;
m_remoteWindowSize = remoteWindowSize;
- m_remoteMaxPacketSize = remoteMaxPacketSize - sizeof(quint32) - sizeof m_remoteChannel - 1;
- // Original value includes packet type, channel number and length field for string.
+ m_remoteMaxPacketSize = remoteMaxPacketSize;
setChannelState(SessionEstablished);
handleOpenSuccessInternal();
}