summaryrefslogtreecommitdiff
path: root/src/doom/g_game.c
diff options
context:
space:
mode:
authorSimon Howard2014-03-29 21:23:29 -0400
committerSimon Howard2014-03-29 21:23:29 -0400
commit040ca1cfb5a3e1be7d05bcd90eaa4f01fb68437a (patch)
treea18e508d59f858f2d4bfda860a299a8f271a080a /src/doom/g_game.c
parente76b5678bfcac6fc7a42b2f581192ae08831728e (diff)
downloadchocolate-doom-040ca1cfb5a3e1be7d05bcd90eaa4f01fb68437a.tar.gz
chocolate-doom-040ca1cfb5a3e1be7d05bcd90eaa4f01fb68437a.tar.bz2
chocolate-doom-040ca1cfb5a3e1be7d05bcd90eaa4f01fb68437a.zip
doom: Eliminate use of unsafe string functions.
Eliminate use of strcpy, strcat, strncpy, and use the new safe alternatives.
Diffstat (limited to 'src/doom/g_game.c')
-rw-r--r--src/doom/g_game.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/src/doom/g_game.c b/src/doom/g_game.c
index 1c838e92..c6b71e01 100644
--- a/src/doom/g_game.c
+++ b/src/doom/g_game.c
@@ -955,7 +955,11 @@ void G_Ticker (void)
case BTS_SAVEGAME:
if (!savedescription[0])
- strcpy (savedescription, "NET GAME");
+ {
+ M_StringCopy(savedescription, "NET GAME",
+ sizeof(savedescription));
+ }
+
savegameslot =
(players[i].cmd.buttons & BTS_SAVEMASK)>>BTS_SAVESHIFT;
gameaction = ga_savegame;
@@ -1512,7 +1516,7 @@ char savename[256];
void G_LoadGame (char* name)
{
- strcpy (savename, name);
+ M_StringCopy(savename, name, sizeof(savename));
gameaction = ga_loadgame;
}
@@ -1574,13 +1578,13 @@ void G_DoLoadGame (void)
void
G_SaveGame
( int slot,
- char* description )
-{
- savegameslot = slot;
- strcpy (savedescription, description);
- sendsave = true;
-}
-
+ char* description )
+{
+ savegameslot = slot;
+ M_StringCopy(savedescription, description, sizeof(savedescription));
+ sendsave = true;
+}
+
void G_DoSaveGame (void)
{
char *savegame_file;
@@ -1631,7 +1635,7 @@ void G_DoSaveGame (void)
rename(temp_savegame_file, savegame_file);
gameaction = ga_nothing;
- strcpy(savedescription, "");
+ M_StringCopy(savedescription, "", sizeof(savedescription));
players[consoleplayer].message = DEH_String(GGSAVED);