forked from qt-creator/qt-creator
SSH: Fix packet size bug.
Uncovered by testing with dropbear. Change-Id: Icd06ad5a20b568f7eef66d7f7381165cac4908d7 Reviewed-by: Christian Kandeler <christian.kandeler@nokia.com>
This commit is contained in:
@@ -116,8 +116,8 @@ void AbstractSshChannel::handleWindowAdjust(quint32 bytesToAdd)
|
|||||||
|
|
||||||
void AbstractSshChannel::flushSendBuffer()
|
void AbstractSshChannel::flushSendBuffer()
|
||||||
{
|
{
|
||||||
const quint32 bytesToSend
|
const quint32 bytesToSend = qMin(m_remoteMaxPacketSize,
|
||||||
= qMin<quint32>(m_remoteWindowSize, m_sendBuffer.size());
|
qMin<quint32>(m_remoteWindowSize, m_sendBuffer.size()));
|
||||||
if (bytesToSend > 0) {
|
if (bytesToSend > 0) {
|
||||||
const QByteArray &data = m_sendBuffer.left(bytesToSend);
|
const QByteArray &data = m_sendBuffer.left(bytesToSend);
|
||||||
m_sendFacility.sendChannelDataPacket(m_remoteChannel, data);
|
m_sendFacility.sendChannelDataPacket(m_remoteChannel, data);
|
||||||
@@ -147,7 +147,8 @@ void AbstractSshChannel::handleOpenSuccess(quint32 remoteChannelId,
|
|||||||
#endif
|
#endif
|
||||||
m_remoteChannel = remoteChannelId;
|
m_remoteChannel = remoteChannelId;
|
||||||
m_remoteWindowSize = remoteWindowSize;
|
m_remoteWindowSize = remoteWindowSize;
|
||||||
m_remoteMaxPacketSize = remoteMaxPacketSize;
|
m_remoteMaxPacketSize = remoteMaxPacketSize - sizeof(quint32) - sizeof m_remoteChannel - 1;
|
||||||
|
// Original value includes packet type, channel number and length field for string.
|
||||||
setChannelState(SessionEstablished);
|
setChannelState(SessionEstablished);
|
||||||
handleOpenSuccessInternal();
|
handleOpenSuccessInternal();
|
||||||
}
|
}
|
||||||
|
@@ -297,6 +297,9 @@ void SshOutgoingPacket::finalize()
|
|||||||
qDebug("Encrypting packet of type %u", m_data.at(TypeOffset));
|
qDebug("Encrypting packet of type %u", m_data.at(TypeOffset));
|
||||||
#endif
|
#endif
|
||||||
encrypt();
|
encrypt();
|
||||||
|
#ifdef CREATOR_SSH_DEBUG
|
||||||
|
qDebug("Sending packet of size %d", rawData().count());
|
||||||
|
#endif
|
||||||
Q_ASSERT(isComplete());
|
Q_ASSERT(isComplete());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user