From 485ecdded514015dc18672b724d75964b88c60ae Mon Sep 17 00:00:00 2001 From: Alug Date: Mon, 24 Nov 2025 02:35:32 +0100 Subject: [PATCH] ensure all our savebuffers are initialized just some safety --- src/d_clisrv.c | 18 ++++++++++-------- src/d_netcmd.c | 2 +- src/g_game.c | 8 ++++---- src/p_setup.c | 2 +- 4 files changed, 16 insertions(+), 14 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index f924f10cb..fd67148ea 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -121,7 +121,7 @@ UINT32 realpingtable[MAXPLAYERS] = {}; //the base table of ping where an average UINT32 playerpingtable[MAXPLAYERS] = {}; //table of player latency values. #define GENTLEMANSMOOTHING (TICRATE) -static tic_t reference_lag; +static tic_t reference_lag = 0; static UINT8 spike_time; tic_t lowest_lag = 0; tic_t simulated_lag = 0; @@ -505,10 +505,12 @@ static void ExtraDataTicker(void) } // If you are a client, you can safely forget the net commands for this tic - // If you are the server, you need to remember them until every client has been aknowledged, - // because if you need to resend a PT_SERVERTICS packet, you need to put the commands in it + // If you are the server, you need to remember them until every client has been acknowledged, + // because if you need to resend a PT_SERVERTICS packet, you will need to put the commands in it if (client) + { D_FreeTextcmd(gametic); + } } static void D_Clearticcmd(tic_t tic) @@ -1929,7 +1931,7 @@ static boolean SV_ResendingSavegameToAnyone(void) static void SV_SendSaveGame(INT32 node, boolean resending) { size_t length, compressedlen; - savebuffer_t save; + savebuffer_t save = {0}; UINT8 *compressedsave; UINT8 *buffertosend; @@ -1999,7 +2001,7 @@ static consvar_t cv_dumpconsistency = {"dumpconsistency", "Off", CV_NETVAR, CV_O static void SV_SavedGame(void) { size_t length; - savebuffer_t save; + savebuffer_t save = {0}; char tmpsave[264]; if (!cv_dumpconsistency.value) @@ -2039,7 +2041,7 @@ static void SV_SavedGame(void) static void CL_LoadReceivedSavegame(boolean reloading) { - savebuffer_t save; + savebuffer_t save = {0}; size_t length, decompressedlen; char tmpsave[264]; @@ -7254,7 +7256,7 @@ void CL_ClearRewinds(void) rewind_t *CL_SaveRewindPoint(size_t demopos) { - savebuffer_t save; + savebuffer_t save = {0}; rewind_t *rewind; if (rewindhead && rewindhead->leveltime + REWIND_POINT_INTERVAL > leveltime) @@ -7277,7 +7279,7 @@ rewind_t *CL_SaveRewindPoint(size_t demopos) rewind_t *CL_RewindToTime(tic_t time) { - savebuffer_t save; + savebuffer_t save = {0}; rewind_t *rewind; while (rewindhead && rewindhead->leveltime > time) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index ed94e66f0..df832d9a3 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -5690,7 +5690,7 @@ static void Command_Togglemodified_f(void) static void Command_Archivetest_f(void) { - savebuffer_t save; + savebuffer_t save = {0}; UINT32 i, wrote; thinker_t *th; if (gamestate != GS_LEVEL) diff --git a/src/g_game.c b/src/g_game.c index 1408442dc..5d93243ef 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -3450,7 +3450,7 @@ void G_LoadGameData(void) INT32 i, j; UINT8 modded = false; UINT8 rtemp; - savebuffer_t save; + savebuffer_t save = {0}; //For records tic_t rectime; @@ -3583,7 +3583,7 @@ void G_SaveGameData(boolean force) size_t length; INT32 i, j; UINT8 btemp; - savebuffer_t save; + savebuffer_t save = {0}; (void)force; char backupfile[MAX_WADPATH+4]; @@ -3754,7 +3754,7 @@ void G_LoadGame(UINT32 slot, INT16 mapoverride) size_t length; char vcheck[VERSIONSIZE]; char savename[255]; - savebuffer_t save; + savebuffer_t save = {0}; // memset savedata to all 0, fixes calling perfectly valid saves corrupt because of bots memset(&savedata, 0, sizeof(savedata)); @@ -3840,7 +3840,7 @@ void G_SaveGame(UINT32 savegameslot) boolean saved; char savename[256] = ""; const char *backup; - savebuffer_t save; + savebuffer_t save = {0}; sprintf(savename, savegamename, savegameslot); backup = va("%s",savename); diff --git a/src/p_setup.c b/src/p_setup.c index 0ec71ea27..bd3ddd973 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -1022,7 +1022,7 @@ void P_WriteThings(lumpnum_t lumpnum) size_t i, length; mapthing_t *mt; UINT8 *data; - savebuffer_t save; + savebuffer_t save = {0}; INT16 temp; data = W_CacheLumpNum(lumpnum, PU_LEVEL);