diff options
author | Simon Howard | 2014-03-29 21:24:03 -0400 |
---|---|---|
committer | Simon Howard | 2014-03-29 21:24:03 -0400 |
commit | 5f9b4368a2adad65dcc960a76c45d12059ca7214 (patch) | |
tree | 8b9096d02849b47fb4b445989704a8cde733583b /src/heretic/ct_chat.c | |
parent | 040ca1cfb5a3e1be7d05bcd90eaa4f01fb68437a (diff) | |
download | chocolate-doom-5f9b4368a2adad65dcc960a76c45d12059ca7214.tar.gz chocolate-doom-5f9b4368a2adad65dcc960a76c45d12059ca7214.tar.bz2 chocolate-doom-5f9b4368a2adad65dcc960a76c45d12059ca7214.zip |
heretic: Eliminate use of unsafe string functions.
Eliminate use of strcpy, strcat, strncpy, and use the new safe
alternatives.
Diffstat (limited to 'src/heretic/ct_chat.c')
-rw-r--r-- | src/heretic/ct_chat.c | 12 |
1 files changed, 7 insertions, 5 deletions
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) |