Engine: reject connection is session ID hashing failed

If hashing failed, the other checks will fail regardless, return out early.
This commit is contained in:
Kawe Mazidjatari 2024-02-25 19:57:45 +01:00
parent 4ce38ba725
commit a1e4500b98

View File

@ -173,6 +173,9 @@ bool CClient::Authenticate(const char* const playerName, char* const reasonBuf,
uint8_t oobHash[32]; // hash of data collected from out of band packet uint8_t oobHash[32]; // hash of data collected from out of band packet
const int shRet = mbedtls_sha256((const uint8_t*)newId, idLen, oobHash, NULL); const int shRet = mbedtls_sha256((const uint8_t*)newId, idLen, oobHash, NULL);
if (shRet != NULL)
ERROR_AND_RETURN("Session ID hashing failed");
if (memcmp(oobHash, sessionHash, sizeof(sessionHash)) != 0) if (memcmp(oobHash, sessionHash, sizeof(sessionHash)) != 0)
ERROR_AND_RETURN("Token is not authorized for the connecting client"); ERROR_AND_RETURN("Token is not authorized for the connecting client");