From 5f9b4368a2adad65dcc960a76c45d12059ca7214 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Sat, 29 Mar 2014 21:24:03 -0400 Subject: heretic: Eliminate use of unsafe string functions. Eliminate use of strcpy, strcat, strncpy, and use the new safe alternatives. --- src/heretic/g_game.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/heretic/g_game.c') diff --git a/src/heretic/g_game.c b/src/heretic/g_game.c index c48b9c8e..64186769 100644 --- a/src/heretic/g_game.c +++ b/src/heretic/g_game.c @@ -1008,16 +1008,16 @@ void G_Ticker(void) { if (netgame) { - strncpy(savedescription, DEH_String("NET GAME"), - sizeof(savedescription)); + M_StringCopy(savedescription, + DEH_String("NET GAME"), + sizeof(savedescription)); } else { - strncpy(savedescription, DEH_String("SAVE GAME"), - sizeof(savedescription)); + M_StringCopy(savedescription, + DEH_String("SAVE GAME"), + sizeof(savedescription)); } - - savedescription[sizeof(savedescription) - 1] = '\0'; } savegameslot = (players[i].cmd. @@ -1672,8 +1672,8 @@ void G_RecordDemo(skill_t skill, int numplayers, int episode, int map, G_InitNew(skill, episode, map); usergame = false; - strcpy(demoname, name); - strcat(demoname, ".lmp"); + M_StringCopy(demoname, name, sizeof(demoname)); + M_StringConcat(demoname, ".lmp", sizeof(demoname)); demobuffer = demo_p = Z_Malloc(0x20000, PU_STATIC, NULL); *demo_p++ = skill; *demo_p++ = episode; @@ -1816,7 +1816,7 @@ boolean G_CheckDemoStatus(void) void G_SaveGame(int slot, char *description) { savegameslot = slot; - strcpy(savedescription, description); + M_StringCopy(savedescription, description, sizeof(savedescription)); sendsave = true; } -- cgit v1.2.3