Fixed segfault in SshKeyExchange due to using object after deletion

m_dhKey pointer has been used for debug output just after
resetting it to nullptr.

Change-Id: I1aa4e16b19c7a16738b7734423277cf7eecd8054
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
This commit is contained in:
Dmytro Poplavskiy
2016-02-22 15:28:58 +10:00
parent 466bf485b0
commit 51edace421

View File

@@ -154,9 +154,9 @@ void SshKeyExchange::sendNewKeysPacket(const SshIncomingPacket &dhReply,
DH_KA_Operation dhOp(*m_dhKey);
SecureVector<byte> encodedF = BigInt::encode(reply.f);
encodedK = dhOp.agree(encodedF, encodedF.size());
m_dhKey.reset(nullptr);
printData("y", AbstractSshPacket::encodeMpInt(m_dhKey->get_y()));
printData("f", AbstractSshPacket::encodeMpInt(reply.f));
m_dhKey.reset(nullptr);
} else {
Q_ASSERT(m_ecdhKey);
concatenatedData // Q_C.