From 6e7f9d2ae2f88ab216120878171cc7f1f14d1afc Mon Sep 17 00:00:00 2001 From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com> Date: Sun, 25 Feb 2024 19:57:45 +0100 Subject: [PATCH] Engine: reject connection is session ID hashing failed If hashing failed, the other checks will fail regardless, return out early. --- r5dev/engine/client/client.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/r5dev/engine/client/client.cpp b/r5dev/engine/client/client.cpp index dc5182d4..f53c2b28 100644 --- a/r5dev/engine/client/client.cpp +++ b/r5dev/engine/client/client.cpp @@ -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 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) ERROR_AND_RETURN("Token is not authorized for the connecting client");