Core/Misc: Multiple static analysis issues fixed (small optimizations and clear code)

This commit is contained in:
DDuarte committed 2014-09-19 03:30:02 +01:00
1 parent e6b7de8c97
commit cefcde9ba9
40 files changed
+72 -84

No files matched your search

+3 -3
View File
@@ -232,7 +232,7 @@ void WorldSocket::SendPacket(WorldPacket& packet)
void WorldSocket::HandleAuthSession(WorldPacket& recvPacket)
{
uint8 digest[20];
uint8 digest[SHA_DIGEST_LENGTH];
uint32 clientSeed;
uint8 security;
uint32 id;
@@ -349,7 +349,7 @@ void WorldSocket::HandleAuthSession(WorldPacket& recvPacket)
sha.UpdateBigNumbers(&k, NULL);
sha.Finalize();
if (memcmp(sha.GetDigest(), digest, 20))
if (memcmp(sha.GetDigest(), digest, SHA_DIGEST_LENGTH) != 0)
{
SendAuthResponseError(AUTH_FAILED);
TC_LOG_ERROR("network", "WorldSocket::HandleAuthSession: Authentication failed for account: %u ('%s') address: %s", id, account.c_str(), address.c_str());
@@ -360,7 +360,7 @@ void WorldSocket::HandleAuthSession(WorldPacket& recvPacket)
///- Re-check ip locking (same check as in auth).
if (fields[3].GetUInt8() == 1) // if ip is locked
{
if (strcmp(fields[2].GetCString(), address.c_str()))
if (strcmp(fields[2].GetCString(), address.c_str()) != 0)
{
SendAuthResponseError(AUTH_FAILED);
TC_LOG_DEBUG("network", "WorldSocket::HandleAuthSession: Sent Auth Response (Account IP differs. Original IP: %s, new IP: %s).", fields[2].GetCString(), address.c_str());