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/d_main.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/d_main.c')
-rw-r--r-- | src/heretic/d_main.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/heretic/d_main.c b/src/heretic/d_main.c index 178db2eb..7a5517f2 100644 --- a/src/heretic/d_main.c +++ b/src/heretic/d_main.c @@ -48,6 +48,7 @@ #include "m_argv.h" #include "m_config.h" #include "m_controls.h" +#include "m_misc.h" #include "p_local.h" #include "s_sound.h" #include "w_main.h" @@ -543,7 +544,7 @@ void status(char *string) { if (using_graphical_startup) { - strcat(smsg, string); + M_StringConcat(smsg, string, sizeof(smsg)); drawstatus(); } } @@ -676,7 +677,7 @@ void tprintf(char *msg, int initflag) if (initflag) tmsg[0] = 0; - strcat(tmsg, msg); + M_StringConcat(tmsg, msg, sizeof(tmsg)); blitStartup(); DrawThermo(); _setbkcolor(4); @@ -685,7 +686,11 @@ void tprintf(char *msg, int initflag) if ((tmsg[i] == '\n') || (!tmsg[i])) { memset(temp, 0, 80); - strncpy(temp, tmsg + start, i - start); + M_StringCopy(temp, tmsg + start, sizeof(temp)); + if (i - start < sizeof(temp)) + { + temp[i - start] = '\0'; + } _settextposition(MSG_Y + add, 40 - strlen(temp) / 2); _outtext(temp); start = i + 1; |