fix some strncopy warnings

This commit is contained in:
Alug committed 2025-05-29 11:48:00 +02:00
1 parent 298323657c
commit 6c9d68eaaa
3 files changed
+3 -7

No files matched your search

+1 -2
View File
@@ -8596,8 +8596,7 @@ static void M_DrawMusicTest(void)
if (t == st_sel && namelength > MAXLENGTH)
scrollMusicName(songname, namelength, MAXLENGTH, buf);
else
strncpy(buf, songname, MAXLENGTH);
buf[MAXLENGTH] = 0;
strlcpy(buf, songname, MAXLENGTH);
V_DrawString(x, y, (t == st_sel ? V_YELLOWMAP : 0)|V_ALLOWLOWERCASE|V_MONOSPACE, buf);
if (curplaying == soundtestdefs[t])
+1 -3
View File
@@ -2313,9 +2313,7 @@ static void P_RunLevelScript(const char *scriptname)
lumpnum_t lumpnum;
char newname[9];
strncpy(newname, scriptname, 8);
newname[8] = '\0';
strlcpy(newname, scriptname, sizeof(newname));
lumpnum = W_CheckNumForName(newname);
+1 -2
View File
@@ -2200,12 +2200,11 @@ static void Command_Tunes_f(void)
if (tunenum)
snprintf(mapmusic.name, 7, "%sM", G_BuildMapName(tunenum));
else
strncpy(mapmusic.name, tunearg, 7);
strlcpy(mapmusic.name, tunearg, sizeof(mapmusic.name));
if (argc > 4)
position = (UINT32)atoi(COM_Argv(4));
mapmusic.name[6] = 0;
mapmusic.flags = (track & MUSIC_TRACKMASK);
mapmusic.position = position;
mapmusic.resume = 0;