From b1c055369d3ab9ee6d05693c8562ee6db25d167f Mon Sep 17 00:00:00 2001 From: etojuice Date: Thu, 12 Nov 2020 02:25:00 +0300 Subject: [PATCH 1/2] Fix crash caused by ReloadMapCycleFile function --- regamedll/dlls/multiplay_gamerules.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/regamedll/dlls/multiplay_gamerules.cpp b/regamedll/dlls/multiplay_gamerules.cpp index b0a8ebdb7..49e26c5fd 100644 --- a/regamedll/dlls/multiplay_gamerules.cpp +++ b/regamedll/dlls/multiplay_gamerules.cpp @@ -4418,7 +4418,12 @@ int ReloadMapCycleFile(char *filename, mapcycle_t *cycle) if (Q_strlen(pToken) <= 0) break; +#ifdef REGAMEDLL_FIXES + Q_strncpy(szMap, pToken, sizeof(szMap) - 1); + szMap[sizeof(szMap) - 1] = 0; +#else Q_strcpy(szMap, pToken); +#endif // Any more tokens on this line? if (SharedTokenWaiting(pFileList)) From bbfc3fe589831ef15c5815dd93e60781daf7b102 Mon Sep 17 00:00:00 2001 From: etojuice Date: Thu, 12 Nov 2020 02:26:59 +0300 Subject: [PATCH 2/2] lil fix --- regamedll/dlls/multiplay_gamerules.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/regamedll/dlls/multiplay_gamerules.cpp b/regamedll/dlls/multiplay_gamerules.cpp index 49e26c5fd..558b10a52 100644 --- a/regamedll/dlls/multiplay_gamerules.cpp +++ b/regamedll/dlls/multiplay_gamerules.cpp @@ -4420,7 +4420,7 @@ int ReloadMapCycleFile(char *filename, mapcycle_t *cycle) #ifdef REGAMEDLL_FIXES Q_strncpy(szMap, pToken, sizeof(szMap) - 1); - szMap[sizeof(szMap) - 1] = 0; + szMap[sizeof(szMap) - 1] = '\0'; #else Q_strcpy(szMap, pToken); #endif