summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/heretic/ct_chat.c4
-rw-r--r--src/heretic/d_main.c19
-rw-r--r--src/heretic/g_game.c14
3 files changed, 23 insertions, 14 deletions
diff --git a/src/heretic/ct_chat.c b/src/heretic/ct_chat.c
index 958d1fff..8059b74d 100644
--- a/src/heretic/ct_chat.c
+++ b/src/heretic/ct_chat.c
@@ -301,7 +301,9 @@ void CT_Ticker(void)
CT_AddChar(i, 0); // set the end of message character
if (numplayers > 2)
{
- strcpy(plr_lastmsg[i], DEH_String(CT_FromPlrText[i]));
+ strncpy(plr_lastmsg[i], DEH_String(CT_FromPlrText[i]),
+ MESSAGESIZE + 9);
+ plr_lastmsg[i][MESSAGESIZE + 8] = '\0';
strcat(plr_lastmsg[i], chat_msg[i]);
}
else
diff --git a/src/heretic/d_main.c b/src/heretic/d_main.c
index 6b589d02..901d763d 100644
--- a/src/heretic/d_main.c
+++ b/src/heretic/d_main.c
@@ -700,7 +700,7 @@ void tprintf(char *msg, int initflag)
// haleyjd: moved up, removed WATCOMC code
void CleanExit(void)
{
- printf(DEH_String("Exited from HERETIC.\n"));
+ DEH_printf("Exited from HERETIC.\n");
exit(1);
}
@@ -849,7 +849,7 @@ void D_DoomMain(void)
//
// init subsystems
//
- printf(DEH_String("V_Init: allocate screens.\n"));
+ DEH_printf("V_Init: allocate screens.\n");
V_Init();
// Check for -CDROM
@@ -882,14 +882,14 @@ void D_DoomMain(void)
}
// Load defaults before initing other systems
- printf(DEH_String("M_LoadDefaults: Load system defaults.\n"));
+ DEH_printf("M_LoadDefaults: Load system defaults.\n");
D_BindVariables();
M_SetConfigFilenames("heretic.cfg", PROGRAM_PREFIX "heretic.cfg");
M_LoadDefaults();
I_AtExit(M_SaveDefaults, false);
- printf(DEH_String("Z_Init: Init zone memory allocation daemon.\n"));
+ DEH_printf("Z_Init: Init zone memory allocation daemon.\n");
Z_Init();
#ifdef FEATURE_DEHACKED
@@ -897,7 +897,7 @@ void D_DoomMain(void)
DEH_Init();
#endif
- printf(DEH_String("W_Init: Init WADfiles.\n"));
+ DEH_printf("W_Init: Init WADfiles.\n");
iwadfile = D_FindIWAD(IWAD_MASK_HERETIC, &gamemission);
@@ -917,9 +917,9 @@ void D_DoomMain(void)
}
if (p && p < myargc - 1)
{
- sprintf(file, DEH_String("%s.lmp"), myargv[p + 1]);
+ DEH_snprintf(file, sizeof(file), "%s.lmp", myargv[p + 1]);
D_AddFile(file);
- printf(DEH_String("Playing demo %s.lmp.\n"), myargv[p + 1]);
+ DEH_printf("Playing demo %s.lmp.\n", myargv[p + 1]);
}
if (W_CheckNumForName(DEH_String("E2M1")) == -1)
@@ -958,8 +958,9 @@ void D_DoomMain(void)
if (autostart)
{
char temp[64];
- sprintf(temp, DEH_String("Warp to Episode %d, Map %d, Skill %d "),
- startepisode, startmap, startskill + 1);
+ DEH_snprintf(temp, sizeof(temp),
+ "Warp to Episode %d, Map %d, Skill %d ",
+ startepisode, startmap, startskill + 1);
status(temp);
}
wadprintf(); // print the added wadfiles
diff --git a/src/heretic/g_game.c b/src/heretic/g_game.c
index 211d0b67..b37f95e0 100644
--- a/src/heretic/g_game.c
+++ b/src/heretic/g_game.c
@@ -863,12 +863,16 @@ void G_Ticker(void)
{
if (netgame)
{
- strcpy(savedescription, DEH_String("NET GAME"));
+ strncpy(savedescription, DEH_String("NET GAME"),
+ sizeof(savedescription));
}
else
{
- strcpy(savedescription, DEH_String("SAVE GAME"));
+ strncpy(savedescription, DEH_String("SAVE GAME"),
+ sizeof(savedescription));
}
+
+ savedescription[sizeof(savedescription) - 1] = '\0';
}
savegameslot =
(players[i].cmd.
@@ -1321,7 +1325,9 @@ void G_DoLoadGame(void)
save_p = savebuffer + SAVESTRINGSIZE;
// Skip the description field
memset(vcheck, 0, sizeof(vcheck));
- sprintf(vcheck, DEH_String("version %i"), HERETIC_VERSION);
+
+ DEH_snprintf(vcheck, VERSIONSIZE, "version %i", HERETIC_VERSION);
+
if (strcmp((char *) save_p, vcheck) != 0)
{ // Bad version
return;
@@ -1695,7 +1701,7 @@ void G_DoSaveGame(void)
SV_Open(name);
SV_Write(description, SAVESTRINGSIZE);
memset(verString, 0, sizeof(verString));
- sprintf(verString, DEH_String("version %i"), HERETIC_VERSION);
+ DEH_snprintf(verString, VERSIONSIZE, "version %i", HERETIC_VERSION);
SV_Write(verString, VERSIONSIZE);
SV_WriteByte(gameskill);
SV_WriteByte(gameepisode);