From 15dddc77013f5366b77a73ca02f58680eaef9736 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Thu, 2 Jan 2014 18:08:38 +0100 Subject: More memory alignment fixes. Ref.: #420. --- src/Protocol/Protocol132.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/Protocol/Protocol132.cpp') diff --git a/src/Protocol/Protocol132.cpp b/src/Protocol/Protocol132.cpp index 346607b79..46ac4ef89 100644 --- a/src/Protocol/Protocol132.cpp +++ b/src/Protocol/Protocol132.cpp @@ -886,15 +886,15 @@ void cProtocol132::HandleEncryptionKeyResponse(const AString & a_EncKey, const A time_t CurTime = time(NULL); CryptoPP::RandomPool rng; rng.Put((const byte *)&CurTime, sizeof(CurTime)); - byte DecryptedNonce[MAX_ENC_LEN]; - DecodingResult res = rsaDecryptor.Decrypt(rng, (const byte *)a_EncNonce.data(), a_EncNonce.size(), DecryptedNonce); + Int32 DecryptedNonce[MAX_ENC_LEN / sizeof(Int32)]; + DecodingResult res = rsaDecryptor.Decrypt(rng, (const byte *)a_EncNonce.data(), a_EncNonce.size(), (byte *)DecryptedNonce); if (!res.isValidCoding || (res.messageLength != 4)) { LOGD("Bad nonce length"); m_Client->Kick("Hacked client"); return; } - if (ntohl(*((int *)DecryptedNonce)) != (unsigned)(uintptr_t)this) + if (ntohl(DecryptedNonce[0]) != (unsigned)(uintptr_t)this) { LOGD("Bad nonce value"); m_Client->Kick("Hacked client"); -- cgit v1.2.3