From f90c8cda61531a3974593a339fd19c1b80538935 Mon Sep 17 00:00:00 2001 From: "seer-by-sentry[bot]" <157164994+seer-by-sentry[bot]@users.noreply.github.com> Date: Wed, 1 Apr 2026 11:32:47 +0000 Subject: [PATCH] bugfix(lobby): Fix potential use-after-free when HTTP response arrives after interface destruction --- .../GeneralsOnline/OnlineServices_LobbyInterface.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/GeneralsMD/Code/GameEngine/Source/GameNetwork/GeneralsOnline/OnlineServices_LobbyInterface.cpp b/GeneralsMD/Code/GameEngine/Source/GameNetwork/GeneralsOnline/OnlineServices_LobbyInterface.cpp index faa825d863..4fc6398a35 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameNetwork/GeneralsOnline/OnlineServices_LobbyInterface.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameNetwork/GeneralsOnline/OnlineServices_LobbyInterface.cpp @@ -772,6 +772,10 @@ void NGMP_OnlineServices_LobbyInterface::UpdateRoomDataCache(std::functionGetHTTPManager()->SendGETRequest(strURI.c_str(), EIPProtocolVersion::DONT_CARE, mapHeaders, [=](bool bSuccess, int statusCode, std::string strBody, HTTPRequest* pReq) { + // safety, lobby interface could've been destroyed by the time we get our response (use-after-free guard) + if (NGMP_OnlineServicesManager::GetInterface() == nullptr) + return; + // safety, lobby could've been torn down by the time we get our response if (m_CurrentLobby.lobbyID != -1 && TheNGMPGame != nullptr) {