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/ct_chat.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/heretic/ct_chat.c') diff --git a/src/heretic/ct_chat.c b/src/heretic/ct_chat.c index 19c27bb2..80ad8c87 100644 --- a/src/heretic/ct_chat.c +++ b/src/heretic/ct_chat.c @@ -33,6 +33,7 @@ #include "deh_str.h" #include "m_controls.h" +#include "m_misc.h" #include "p_local.h" #include "s_sound.h" #include "v_video.h" @@ -288,14 +289,15 @@ void CT_Ticker(void) CT_AddChar(i, 0); // set the end of message character if (numplayers > 2) { - strncpy(plr_lastmsg[i], DEH_String(CT_FromPlrText[i]), - MESSAGESIZE + 9); - plr_lastmsg[i][MESSAGESIZE + 8] = '\0'; - strcat(plr_lastmsg[i], chat_msg[i]); + M_StringCopy(plr_lastmsg[i], DEH_String(CT_FromPlrText[i]), + sizeof(plr_lastmsg[i])); + M_StringConcat(plr_lastmsg[i], chat_msg[i], + sizeof(plr_lastmsg[i])); } else { - strcpy(plr_lastmsg[i], chat_msg[i]); + M_StringCopy(plr_lastmsg[i], chat_msg[i], + sizeof(plr_lastmsg[i])); } if (i != consoleplayer && (chat_dest[i] == consoleplayer + 1 || chat_dest[i] == CT_PLR_ALL) -- cgit v1.2.3