From 3e33b472a79cde31ef137cdc957818d61f41477b Mon Sep 17 00:00:00 2001 From: David Markowitz Date: Fri, 22 Sep 2023 17:25:38 -0700 Subject: [PATCH] Patch GM9 exploit --- dGame/dGameMessages/GameMessages.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/dGame/dGameMessages/GameMessages.cpp b/dGame/dGameMessages/GameMessages.cpp index 83f832b2b..2a6405fdd 100644 --- a/dGame/dGameMessages/GameMessages.cpp +++ b/dGame/dGameMessages/GameMessages.cpp @@ -4909,6 +4909,13 @@ void GameMessages::HandleParseChatMessage(RakNet::BitStream* inStream, Entity* e inStream->Read(character); wsString.push_back(character); } + + auto player = Player::GetPlayer(sysAddr); + if (!player || !player->GetCharacter()) return; + if (player->GetObjectID() != entity->GetObjectID()) { + Game::logger->Log("GameMessages", "Player %s is trying to send a chat message from an entity %llu they do not own!", player->GetCharacter()->GetName().c_str(), entity->GetObjectID()); + return; + } if (wsString[0] == L'/') { SlashCommandHandler::HandleChatCommand(wsString, entity, sysAddr);