Core/Authserver: Fixed writing to invalid memory address

This commit is contained in:
Shauren
2014-08-10 11:48:43 +02:00
parent df11916ad5
commit 39d3480172

View File

@@ -515,10 +515,9 @@ bool AuthSession::HandleLogonProof()
ReadData(1);
uint8 size = *(GetDataBuffer() + sizeof(sAuthLogonProof_C));
ReadData(size);
char* token = reinterpret_cast<char*>(GetDataBuffer() + sizeof(sAuthLogonProof_C) + sizeof(size));
token[size] = '\0';
unsigned int validToken = TOTP::GenerateToken(_tokenKey.c_str());
unsigned int incomingToken = atoi(token);
std::string token(reinterpret_cast<char*>(GetDataBuffer() + sizeof(sAuthLogonProof_C) + sizeof(size)), size);
uint32 validToken = TOTP::GenerateToken(_tokenKey.c_str());
uint32 incomingToken = atoi(token.c_str());
if (validToken != incomingToken)
{
ByteBuffer packet;