From a1a1480be76afea5d5441651e47c6bccb2a91fc9 Mon Sep 17 00:00:00 2001 From: Marek Kulik Date: Fri, 20 Dec 2024 16:34:49 +0100 Subject: [PATCH] Fix reading null bytes in UpdatePingStatus Addendum for 52d4f0c867f82569b8df04b0c34cb2d998ef35a9 --- Client/core/CQueryReceiver.cpp | 2 +- Client/sdk/net/CNet.h | 2 +- Shared/sdk/version.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Client/core/CQueryReceiver.cpp b/Client/core/CQueryReceiver.cpp index 559691bcb3..4d1e516de9 100644 --- a/Client/core/CQueryReceiver.cpp +++ b/Client/core/CQueryReceiver.cpp @@ -183,7 +183,7 @@ SQueryInfo CQueryReceiver::GetServerResponse() // Recover server ping status if present const SString strPingStatus = strBuildNumber.Right(strBuildNumber.length() - strlen(strBuildNumber) - 1); - CCore::GetSingleton().GetNetwork()->UpdatePingStatus(*strPingStatus, info.players, info.isStatusVerified); + CCore::GetSingleton().GetNetwork()->UpdatePingStatus(strPingStatus.c_str(), strPingStatus.length(), info.players, info.isStatusVerified); // Recover server http port if present const SString strNetRoute = strPingStatus.Right(strPingStatus.length() - strlen(strPingStatus) - 1); diff --git a/Client/sdk/net/CNet.h b/Client/sdk/net/CNet.h index cb38718f47..24a61a7a22 100644 --- a/Client/sdk/net/CNet.h +++ b/Client/sdk/net/CNet.h @@ -115,7 +115,7 @@ class CNet virtual const char* GetNextBuffer() = 0; virtual const char* GetDiagnosticStatus() = 0; - virtual void UpdatePingStatus(const char* szStatus, ushort& usDataRef, bool& isVerified) = 0; + virtual void UpdatePingStatus(const char* status, size_t statusLength, ushort& usDataRef, bool& isVerified) = 0; virtual bool VerifySignature(const char* pData, unsigned long ulSize) = 0; diff --git a/Shared/sdk/version.h b/Shared/sdk/version.h index 12d10c80a5..81bfe01318 100644 --- a/Shared/sdk/version.h +++ b/Shared/sdk/version.h @@ -108,7 +108,7 @@ #define _ASE_VERSION QUOTE_DEFINE(MTASA_VERSION_MAJOR) "." QUOTE_DEFINE(MTASA_VERSION_MINOR) #define _NETCODE_VERSION_BRANCH_ID 0x4 // Use 0x1 - 0xF to indicate an incompatible branch is being used (0x0 is reserved, 0x4 is trunk) -#define _CLIENT_NET_MODULE_VERSION 0x0AF // (0x000 - 0xfff) Lvl9 wizards only +#define _CLIENT_NET_MODULE_VERSION 0x0B0 // (0x000 - 0xfff) Lvl9 wizards only #define _SERVER_NET_MODULE_VERSION 0x0AB // (0x000 - 0xfff) Lvl9 wizards only #define _NETCODE_VERSION 0x1DA // (0x000 - 0xfff) Increment when net messages change (pre-release)