diff options
author | Simon Howard | 2014-03-29 21:23:29 -0400 |
---|---|---|
committer | Simon Howard | 2014-03-29 21:23:29 -0400 |
commit | 040ca1cfb5a3e1be7d05bcd90eaa4f01fb68437a (patch) | |
tree | a18e508d59f858f2d4bfda860a299a8f271a080a /src/doom/hu_stuff.c | |
parent | e76b5678bfcac6fc7a42b2f581192ae08831728e (diff) | |
download | chocolate-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/hu_stuff.c')
-rw-r--r-- | src/doom/hu_stuff.c | 21 |
1 files changed, 11 insertions, 10 deletions
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; |