From 1e09ec92e38db5b8e9abc9e0b49351ee669348a0 Mon Sep 17 00:00:00 2001 From: David Markowitz <39972741+EmosewaMC@users.noreply.github.com> Date: Tue, 26 Mar 2024 04:20:45 -0700 Subject: [PATCH] Update PlayerContainer.cpp (#1513) Prevents a bad actor from possibly spamming the server with sequential IDs and allocating a bunch of memory. Tested that I can still send and receive friend requests --- dChatServer/PlayerContainer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dChatServer/PlayerContainer.cpp b/dChatServer/PlayerContainer.cpp index 4e4d1be5..7feff763 100644 --- a/dChatServer/PlayerContainer.cpp +++ b/dChatServer/PlayerContainer.cpp @@ -390,7 +390,7 @@ LWOOBJID PlayerContainer::GetId(const std::u16string& playerName) { } PlayerData& PlayerContainer::GetPlayerDataMutable(const LWOOBJID& playerID) { - return m_Players[playerID]; + return m_Players.contains(playerID) ? m_Players[playerID] : m_Players[LWOOBJID_EMPTY]; } PlayerData& PlayerContainer::GetPlayerDataMutable(const std::string& playerName) {