From 2e34f45c502c7123fd1039c5512b9624c207b174 Mon Sep 17 00:00:00 2001 From: def Date: Tue, 23 Nov 2021 18:48:07 +0100 Subject: [PATCH] Don't access switchers out of bounds (fixes #4386) It's possible that a map was saved with a different amount of switchers than it has at the moment. Happened on Jao Shooter. I'll check with mapper if they changed the number of switchers. --- src/game/server/save.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/game/server/save.cpp b/src/game/server/save.cpp index 1f785bd07..d7c619b20 100644 --- a/src/game/server/save.cpp +++ b/src/game/server/save.cpp @@ -528,7 +528,7 @@ void CSaveTeam::Load(int Team, bool KeepCurrentWeakStrong) if(m_pController->GameServer()->Collision()->m_NumSwitchers) { - for(int i = 1; i < m_pController->GameServer()->Collision()->m_NumSwitchers + 1; i++) + for(int i = 1; i < minimum(m_NumSwitchers, m_pController->GameServer()->Collision()->m_NumSwitchers) + 1; i++) { m_pController->GameServer()->Collision()->m_pSwitchers[i].m_Status[Team] = m_pSwitchers[i].m_Status; if(m_pSwitchers[i].m_EndTime)