parent
c510683d2a
commit
15dddc7701
@ -886,15 +886,15 @@ void cProtocol132::HandleEncryptionKeyResponse(const AString & a_EncKey, const A
|
|||||||
time_t CurTime = time(NULL);
|
time_t CurTime = time(NULL);
|
||||||
CryptoPP::RandomPool rng;
|
CryptoPP::RandomPool rng;
|
||||||
rng.Put((const byte *)&CurTime, sizeof(CurTime));
|
rng.Put((const byte *)&CurTime, sizeof(CurTime));
|
||||||
byte DecryptedNonce[MAX_ENC_LEN];
|
Int32 DecryptedNonce[MAX_ENC_LEN / sizeof(Int32)];
|
||||||
DecodingResult res = rsaDecryptor.Decrypt(rng, (const byte *)a_EncNonce.data(), a_EncNonce.size(), DecryptedNonce);
|
DecodingResult res = rsaDecryptor.Decrypt(rng, (const byte *)a_EncNonce.data(), a_EncNonce.size(), (byte *)DecryptedNonce);
|
||||||
if (!res.isValidCoding || (res.messageLength != 4))
|
if (!res.isValidCoding || (res.messageLength != 4))
|
||||||
{
|
{
|
||||||
LOGD("Bad nonce length");
|
LOGD("Bad nonce length");
|
||||||
m_Client->Kick("Hacked client");
|
m_Client->Kick("Hacked client");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (ntohl(*((int *)DecryptedNonce)) != (unsigned)(uintptr_t)this)
|
if (ntohl(DecryptedNonce[0]) != (unsigned)(uintptr_t)this)
|
||||||
{
|
{
|
||||||
LOGD("Bad nonce value");
|
LOGD("Bad nonce value");
|
||||||
m_Client->Kick("Hacked client");
|
m_Client->Kick("Hacked client");
|
||||||
|
@ -154,13 +154,13 @@ public:
|
|||||||
inline Int16 GetShort(int a_Tag) const
|
inline Int16 GetShort(int a_Tag) const
|
||||||
{
|
{
|
||||||
ASSERT(m_Tags[a_Tag].m_Type == TAG_Short);
|
ASSERT(m_Tags[a_Tag].m_Type == TAG_Short);
|
||||||
return ntohs(*((Int16 *)(m_Data + m_Tags[a_Tag].m_DataStart)));
|
return GetBEShort(m_Data + m_Tags[a_Tag].m_DataStart);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline Int32 GetInt(int a_Tag) const
|
inline Int32 GetInt(int a_Tag) const
|
||||||
{
|
{
|
||||||
ASSERT(m_Tags[a_Tag].m_Type == TAG_Int);
|
ASSERT(m_Tags[a_Tag].m_Type == TAG_Int);
|
||||||
return ntohl(*((Int32 *)(m_Data + m_Tags[a_Tag].m_DataStart)));
|
return GetBEInt(m_Data + m_Tags[a_Tag].m_DataStart);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline Int64 GetLong(int a_Tag) const
|
inline Int64 GetLong(int a_Tag) const
|
||||||
@ -172,7 +172,7 @@ public:
|
|||||||
inline float GetFloat(int a_Tag) const
|
inline float GetFloat(int a_Tag) const
|
||||||
{
|
{
|
||||||
ASSERT(m_Tags[a_Tag].m_Type == TAG_Float);
|
ASSERT(m_Tags[a_Tag].m_Type == TAG_Float);
|
||||||
Int32 tmp = ntohl(*((Int32 *)(m_Data + m_Tags[a_Tag].m_DataStart)));
|
Int32 tmp = GetBEInt(m_Data + m_Tags[a_Tag].m_DataStart);
|
||||||
return *((float *)&tmp);
|
return *((float *)&tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user