From e0fa53e4dfe4d919bc3d887b3553672e72d8dc5b Mon Sep 17 00:00:00 2001 From: Alug Date: Sun, 9 Aug 2026 17:57:18 +0200 Subject: [PATCH] demonames apparently should write one less character better keep it like this --- src/d_netcmd.c | 4 ++-- src/g_demo.c | 4 ++-- src/y_inter.c | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 24d01bef1..f05668c8f 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -2762,11 +2762,11 @@ static void Command_ReplayMarker(void) if (title) { - snprintf(demo.titlename, sizeof(demo.titlename), "%s [%i:%02d/%.5s]", title, G_TicsToMinutes(adjustedleveltime, false), G_TicsToSeconds(adjustedleveltime), modeattacking ? "Record Attack" : connectedservername); + snprintf(demo.titlename, sizeof(demo.titlename)-1, "%s [%i:%02d/%.5s]", title, G_TicsToMinutes(adjustedleveltime, false), G_TicsToSeconds(adjustedleveltime), modeattacking ? "Record Attack" : connectedservername); Z_Free(title); } else - snprintf(demo.titlename, sizeof(demo.titlename), "[%i:%02d/%.5s]", G_TicsToMinutes(adjustedleveltime, false), G_TicsToSeconds(adjustedleveltime), modeattacking ? "Record Attack" : connectedservername); + snprintf(demo.titlename, sizeof(demo.titlename)-1, "[%i:%02d/%.5s]", G_TicsToMinutes(adjustedleveltime, false), G_TicsToSeconds(adjustedleveltime), modeattacking ? "Record Attack" : connectedservername); CONS_Printf("Replay will be saved!\n"); } diff --git a/src/g_demo.c b/src/g_demo.c index cb24999e6..049cf4bfd 100644 --- a/src/g_demo.c +++ b/src/g_demo.c @@ -1723,11 +1723,11 @@ void G_BeginRecording(void) // Print to a separate temp buffer instead of demo.titlename, so we can use it in M_TextInputSetString if (title) { - snprintf(demotitlename, sizeof(demotitlename), "%s - %s", title, modeattacking ? "Time Attack" : connectedservername); + snprintf(demotitlename, sizeof(demotitlename)-1, "%s - %s", title, modeattacking ? "Time Attack" : connectedservername); Z_Free(title); } else - snprintf(demotitlename, sizeof(demotitlename), "%s", modeattacking ? "Time Attack" : connectedservername); + snprintf(demotitlename, sizeof(demotitlename)-1, "%s", modeattacking ? "Time Attack" : connectedservername); // Init just in case it isn't initialized already M_TextInputInit(&demo.titlenameinput, demo.titlename, sizeof(demo.titlename)); diff --git a/src/y_inter.c b/src/y_inter.c index 4ea042aa7..97df280c5 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -663,14 +663,14 @@ static void Y_UpdateRecordReplays(void) snprintf(gpath, glen, "%s"PATHSEP"replay"PATHSEP"%s"PATHSEP"%s", srb2home, timeattackfolder, G_BuildMapName(gamemap)); - snprintf(lastdemo, sizeof(lastdemo), "%s-%s-last.lmp", gpath, cv_chooseskin.string); + snprintf(lastdemo, sizeof(lastdemo)-1, "%s-%s-last.lmp", gpath, cv_chooseskin.string); if (FIL_FileExists(lastdemo)) { UINT8 *buf; size_t len = FIL_ReadFile(lastdemo, &buf); - snprintf(bestdemo, sizeof(bestdemo), "%s-%s-time-best.lmp", gpath, cv_chooseskin.string); + snprintf(bestdemo, sizeof(bestdemo)-1, "%s-%s-time-best.lmp", gpath, cv_chooseskin.string); if (!FIL_FileExists(bestdemo) || G_CmpDemoTime(bestdemo, lastdemo) & 1) { // Better time, save this demo. if (FIL_FileExists(bestdemo)) @@ -679,7 +679,7 @@ static void Y_UpdateRecordReplays(void) CONS_Printf("\x83%s\x80 %s '%s'\n", M_GetText("NEW RECORD TIME!"), M_GetText("Saved replay as"), bestdemo); } - snprintf(bestdemo, sizeof(bestdemo), "%s-%s-lap-best.lmp", gpath, cv_chooseskin.string); + snprintf(bestdemo, sizeof(bestdemo)-1, "%s-%s-lap-best.lmp", gpath, cv_chooseskin.string); if (!FIL_FileExists(bestdemo) || G_CmpDemoTime(bestdemo, lastdemo) & (1<<1)) { // Better lap time, save this demo. if (FIL_FileExists(bestdemo))