From 040ca1cfb5a3e1be7d05bcd90eaa4f01fb68437a Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Sat, 29 Mar 2014 21:23:29 -0400 Subject: doom: Eliminate use of unsafe string functions. Eliminate use of strcpy, strcat, strncpy, and use the new safe alternatives. --- src/doom/hu_stuff.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'src/doom/hu_stuff.c') diff --git a/src/doom/hu_stuff.c b/src/doom/hu_stuff.c index a6047606..1dda6e8a 100644 --- a/src/doom/hu_stuff.c +++ b/src/doom/hu_stuff.c @@ -38,6 +38,7 @@ #include "hu_stuff.h" #include "hu_lib.h" #include "m_controls.h" +#include "m_misc.h" #include "w_wad.h" #include "s_sound.h" @@ -610,11 +611,11 @@ boolean HU_Responder(event_t *ev) HU_queueChatChar(*macromessage++); HU_queueChatChar(KEY_ENTER); - // leave chat mode and notify that it was sent - chat_on = false; - strcpy(lastmessage, chat_macros[c]); - plr->message = lastmessage; - eatkey = true; + // leave chat mode and notify that it was sent + chat_on = false; + M_StringCopy(lastmessage, chat_macros[c], sizeof(lastmessage)); + plr->message = lastmessage; + eatkey = true; } else { @@ -632,11 +633,11 @@ boolean HU_Responder(event_t *ev) if (c == KEY_ENTER) { chat_on = false; - if (w_chat.l.len) - { - strcpy(lastmessage, w_chat.l.l); - plr->message = lastmessage; - } + if (w_chat.l.len) + { + M_StringCopy(lastmessage, w_chat.l.l, sizeof(lastmessage)); + plr->message = lastmessage; + } } else if (c == KEY_ESCAPE) chat_on = false; -- cgit v1.2.3