Revert "Replace a few instance of strncpy with strlcpy"
This reverts commit 2e27f32d3e
.
This commit is contained in:
parent
2e27f32d3e
commit
9b3917cd72
|
@ -419,7 +419,7 @@ static void readPlayer(MYFILE *f, INT32 num)
|
||||||
if (fastcmp(word, "PICNAME"))
|
if (fastcmp(word, "PICNAME"))
|
||||||
{
|
{
|
||||||
SLOTFOUND
|
SLOTFOUND
|
||||||
strlcpy(description[num].picname, word2, sizeof(description->picname));
|
strncpy(description[num].picname, word2, 8);
|
||||||
}
|
}
|
||||||
// new character select
|
// new character select
|
||||||
else if (fastcmp(word, "DISPLAYNAME"))
|
else if (fastcmp(word, "DISPLAYNAME"))
|
||||||
|
@ -3889,7 +3889,9 @@ static void readmaincfg(MYFILE *f)
|
||||||
lumpnum_t lumpnum;
|
lumpnum_t lumpnum;
|
||||||
char newname[9];
|
char newname[9];
|
||||||
|
|
||||||
strlcpy(newname, word2, sizeof(newname));
|
strncpy(newname, word2, 8);
|
||||||
|
|
||||||
|
newname[8] = '\0';
|
||||||
|
|
||||||
lumpnum = W_CheckNumForName(newname);
|
lumpnum = W_CheckNumForName(newname);
|
||||||
|
|
||||||
|
|
|
@ -2338,7 +2338,7 @@ void F_InitMenuPresValues(void)
|
||||||
activeMenuId = MainDef.menuid;
|
activeMenuId = MainDef.menuid;
|
||||||
|
|
||||||
// Set defaults for presentation values
|
// Set defaults for presentation values
|
||||||
strlcpy(curbgname, "TITLESKY", sizeof(curbgname));
|
strncpy(curbgname, "TITLESKY", 9);
|
||||||
curfadevalue = 16;
|
curfadevalue = 16;
|
||||||
curbgcolor = -1;
|
curbgcolor = -1;
|
||||||
curbgxspeed = (gamestate == GS_TIMEATTACK) ? 0 : titlescrollxspeed;
|
curbgxspeed = (gamestate == GS_TIMEATTACK) ? 0 : titlescrollxspeed;
|
||||||
|
@ -2348,7 +2348,7 @@ void F_InitMenuPresValues(void)
|
||||||
curhidepics = hidetitlepics;
|
curhidepics = hidetitlepics;
|
||||||
curttmode = ttmode;
|
curttmode = ttmode;
|
||||||
curttscale = ttscale;
|
curttscale = ttscale;
|
||||||
strlcpy(curttname, ttname, sizeof(curttname));
|
strncpy(curttname, ttname, 9);
|
||||||
curttx = ttx;
|
curttx = ttx;
|
||||||
curtty = tty;
|
curtty = tty;
|
||||||
curttloop = ttloop;
|
curttloop = ttloop;
|
||||||
|
|
14
src/m_menu.c
14
src/m_menu.c
|
@ -2615,7 +2615,7 @@ static boolean MIT_SetCurBackground(UINT32 menutype, INT32 level, INT32 *retval,
|
||||||
}
|
}
|
||||||
else if (menupres[menutype].bgname[0])
|
else if (menupres[menutype].bgname[0])
|
||||||
{
|
{
|
||||||
strlcpy(curbgname, menupres[menutype].bgname, sizeof(curbgname));
|
strncpy(curbgname, menupres[menutype].bgname, 8);
|
||||||
curbgxspeed = menupres[menutype].titlescrollxspeed != INT32_MAX ? menupres[menutype].titlescrollxspeed : titlescrollxspeed;
|
curbgxspeed = menupres[menutype].titlescrollxspeed != INT32_MAX ? menupres[menutype].titlescrollxspeed : titlescrollxspeed;
|
||||||
curbgyspeed = menupres[menutype].titlescrollyspeed != INT32_MAX ? menupres[menutype].titlescrollyspeed : titlescrollyspeed;
|
curbgyspeed = menupres[menutype].titlescrollyspeed != INT32_MAX ? menupres[menutype].titlescrollyspeed : titlescrollyspeed;
|
||||||
return true;
|
return true;
|
||||||
|
@ -2628,7 +2628,7 @@ static boolean MIT_SetCurBackground(UINT32 menutype, INT32 level, INT32 *retval,
|
||||||
curbghide = true;
|
curbghide = true;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
strlcpy(curbgname, defaultname, sizeof(curbgname));
|
strncpy(curbgname, defaultname, 9);
|
||||||
curbgxspeed = (gamestate == GS_TIMEATTACK) ? 0 : titlescrollxspeed;
|
curbgxspeed = (gamestate == GS_TIMEATTACK) ? 0 : titlescrollxspeed;
|
||||||
curbgyspeed = (gamestate == GS_TIMEATTACK) ? 0 : titlescrollyspeed;
|
curbgyspeed = (gamestate == GS_TIMEATTACK) ? 0 : titlescrollyspeed;
|
||||||
}
|
}
|
||||||
|
@ -2767,7 +2767,7 @@ void M_ChangeMenuMusic(const char *defaultmusname, boolean defaultmuslooping)
|
||||||
void M_SetMenuCurBackground(const char *defaultname)
|
void M_SetMenuCurBackground(const char *defaultname)
|
||||||
{
|
{
|
||||||
char name[9];
|
char name[9];
|
||||||
strlcpy(name, defaultname, 9);
|
strncpy(name, defaultname, 8);
|
||||||
M_IterateMenuTree(MIT_SetCurBackground, &name);
|
M_IterateMenuTree(MIT_SetCurBackground, &name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2820,7 +2820,7 @@ static void M_HandleMenuPresState(menu_t *newMenu)
|
||||||
activeMenuId = newMenu ? newMenu->menuid : 0;
|
activeMenuId = newMenu ? newMenu->menuid : 0;
|
||||||
|
|
||||||
// Set defaults for presentation values
|
// Set defaults for presentation values
|
||||||
strlcpy(curbgname, "TITLESKY", sizeof(curbgname));
|
strncpy(curbgname, "TITLESKY", 9);
|
||||||
curfadevalue = 16;
|
curfadevalue = 16;
|
||||||
curhidepics = hidetitlepics;
|
curhidepics = hidetitlepics;
|
||||||
curbgcolor = -1;
|
curbgcolor = -1;
|
||||||
|
@ -5785,7 +5785,7 @@ static void M_DrawLevelPlatterMenu(void)
|
||||||
{
|
{
|
||||||
F_SkyScroll(curbgxspeed, curbgyspeed, curbgname);
|
F_SkyScroll(curbgxspeed, curbgyspeed, curbgname);
|
||||||
// Draw and animate foreground
|
// Draw and animate foreground
|
||||||
if (!strcmp("RECATKBG", curbgname))
|
if (!strncmp("RECATKBG", curbgname, 8))
|
||||||
M_DrawRecordAttackForeground();
|
M_DrawRecordAttackForeground();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6033,7 +6033,7 @@ static void M_DrawMessageMenu(void)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
F_SkyScroll(curbgxspeed, curbgyspeed, curbgname);
|
F_SkyScroll(curbgxspeed, curbgyspeed, curbgname);
|
||||||
if (!strcmp("RECATKBG", curbgname))
|
if (!strncmp("RECATKBG", curbgname, 8))
|
||||||
M_DrawRecordAttackForeground();
|
M_DrawRecordAttackForeground();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9583,7 +9583,7 @@ void M_DrawTimeAttackMenu(void)
|
||||||
{
|
{
|
||||||
F_SkyScroll(curbgxspeed, curbgyspeed, curbgname);
|
F_SkyScroll(curbgxspeed, curbgyspeed, curbgname);
|
||||||
// Draw and animate foreground
|
// Draw and animate foreground
|
||||||
if (!strcmp("RECATKBG", curbgname))
|
if (!strncmp("RECATKBG", curbgname, 8))
|
||||||
M_DrawRecordAttackForeground();
|
M_DrawRecordAttackForeground();
|
||||||
}
|
}
|
||||||
if (curfadevalue)
|
if (curfadevalue)
|
||||||
|
|
|
@ -340,7 +340,7 @@ typedef struct
|
||||||
{
|
{
|
||||||
boolean used;
|
boolean used;
|
||||||
char notes[441];
|
char notes[441];
|
||||||
char picname[9];
|
char picname[8];
|
||||||
char skinname[SKINNAMESIZE*2+2]; // skin&skin\0
|
char skinname[SKINNAMESIZE*2+2]; // skin&skin\0
|
||||||
patch_t *charpic;
|
patch_t *charpic;
|
||||||
UINT8 prev;
|
UINT8 prev;
|
||||||
|
|
|
@ -2883,7 +2883,9 @@ static void P_RunLevelScript(const char *scriptname)
|
||||||
lumpnum_t lumpnum;
|
lumpnum_t lumpnum;
|
||||||
char newname[9];
|
char newname[9];
|
||||||
|
|
||||||
strlcpy(newname, scriptname, sizeof(newname));
|
strncpy(newname, scriptname, 8);
|
||||||
|
|
||||||
|
newname[8] = '\0';
|
||||||
|
|
||||||
lumpnum = W_CheckNumForName(newname);
|
lumpnum = W_CheckNumForName(newname);
|
||||||
|
|
||||||
|
|
|
@ -2603,7 +2603,7 @@ INT32 R_CheckTextureNumForName(const char *name)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
for (i = 0; i < tidcachelen; i++)
|
for (i = 0; i < tidcachelen; i++)
|
||||||
if (!strcasecmp(tidcache[i].name, name))
|
if (!strncasecmp(tidcache[i].name, name, 8))
|
||||||
return tidcache[i].id;
|
return tidcache[i].id;
|
||||||
|
|
||||||
// Need to parse the list backwards, so textures loaded more recently are used in lieu of ones loaded earlier
|
// Need to parse the list backwards, so textures loaded more recently are used in lieu of ones loaded earlier
|
||||||
|
@ -2613,7 +2613,8 @@ INT32 R_CheckTextureNumForName(const char *name)
|
||||||
{
|
{
|
||||||
tidcachelen++;
|
tidcachelen++;
|
||||||
Z_Realloc(tidcache, tidcachelen * sizeof(*tidcache), PU_STATIC, &tidcache);
|
Z_Realloc(tidcache, tidcachelen * sizeof(*tidcache), PU_STATIC, &tidcache);
|
||||||
strlcpy(tidcache[tidcachelen-1].name, name, sizeof(tidcache->name));
|
strncpy(tidcache[tidcachelen-1].name, name, 8);
|
||||||
|
tidcache[tidcachelen-1].name[8] = '\0';
|
||||||
#ifndef ZDEBUG
|
#ifndef ZDEBUG
|
||||||
CONS_Debug(DBG_SETUP, "texture #%s: %s\n", sizeu1(tidcachelen), tidcache[tidcachelen-1].name);
|
CONS_Debug(DBG_SETUP, "texture #%s: %s\n", sizeu1(tidcachelen), tidcache[tidcachelen-1].name);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -391,7 +391,7 @@ const char *R_GetPalname(UINT16 num)
|
||||||
if (num > 0 && num <= 10000)
|
if (num > 0 && num <= 10000)
|
||||||
snprintf(newpal, 8, "PAL%04u", num-1);
|
snprintf(newpal, 8, "PAL%04u", num-1);
|
||||||
|
|
||||||
strlcpy(palname, newpal, sizeof(palname));
|
strncpy(palname, newpal, 8);
|
||||||
return palname;
|
return palname;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -440,15 +440,17 @@ static lumpinfo_t* ResGetLumpsWad (FILE* handle, UINT16* nlmp, const char* filen
|
||||||
else
|
else
|
||||||
lump_p->compression = CM_NOCOMPRESSION;
|
lump_p->compression = CM_NOCOMPRESSION;
|
||||||
memset(lump_p->name, 0x00, 9);
|
memset(lump_p->name, 0x00, 9);
|
||||||
strlcpy(lump_p->name, fileinfo->name, 9);
|
strncpy(lump_p->name, fileinfo->name, 8);
|
||||||
|
|
||||||
// Allocate the lump's long name.
|
// Allocate the lump's long name.
|
||||||
lump_p->longname = Z_Malloc(9 * sizeof(char), PU_STATIC, NULL);
|
lump_p->longname = Z_Malloc(9 * sizeof(char), PU_STATIC, NULL);
|
||||||
strlcpy(lump_p->longname, fileinfo->name, 9);
|
strncpy(lump_p->longname, fileinfo->name, 8);
|
||||||
|
lump_p->longname[8] = '\0';
|
||||||
|
|
||||||
// Allocate the lump's full name.
|
// Allocate the lump's full name.
|
||||||
lump_p->fullname = Z_Malloc(9 * sizeof(char), PU_STATIC, NULL);
|
lump_p->fullname = Z_Malloc(9 * sizeof(char), PU_STATIC, NULL);
|
||||||
strlcpy(lump_p->fullname, fileinfo->name, 9);
|
strncpy(lump_p->fullname, fileinfo->name, 8);
|
||||||
|
lump_p->fullname[8] = '\0';
|
||||||
}
|
}
|
||||||
free(fileinfov);
|
free(fileinfov);
|
||||||
*nlmp = numlumps;
|
*nlmp = numlumps;
|
||||||
|
|
|
@ -1740,8 +1740,9 @@ static void Y_CalculateCompetitionWinners(void)
|
||||||
data.competition.monitors[data.competition.numplayers] = monitors[winner];
|
data.competition.monitors[data.competition.numplayers] = monitors[winner];
|
||||||
data.competition.scores[data.competition.numplayers] = scores[winner];
|
data.competition.scores[data.competition.numplayers] = scores[winner];
|
||||||
|
|
||||||
strlcpy(tempname, player_names[winner], 9);
|
strncpy(tempname, player_names[winner], 8);
|
||||||
strlcpy(data.competition.name[data.competition.numplayers], tempname, 9);
|
tempname[8] = '\0';
|
||||||
|
strncpy(data.competition.name[data.competition.numplayers], tempname, 9);
|
||||||
|
|
||||||
data.competition.color[data.competition.numplayers] = &players[winner].skincolor;
|
data.competition.color[data.competition.numplayers] = &players[winner].skincolor;
|
||||||
data.competition.character[data.competition.numplayers] = &players[winner].skin;
|
data.competition.character[data.competition.numplayers] = &players[winner].skin;
|
||||||
|
|
Loading…
Reference in New Issue