From 2e6e43c4a706e3670f131c7b2d5a5525f9bf0d7b Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Sat, 29 Mar 2014 21:25:55 -0400 Subject: heretic: Eliminate use of unsafe string functions. Eliminate use of strcpy, strcat, strncpy, and use the new safe alternatives. --- src/hexen/p_acs.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/hexen/p_acs.c') diff --git a/src/hexen/p_acs.c b/src/hexen/p_acs.c index 9ca9f6af..27b07682 100644 --- a/src/hexen/p_acs.c +++ b/src/hexen/p_acs.c @@ -26,6 +26,7 @@ // HEADER FILES ------------------------------------------------------------ #include "h2def.h" +#include "m_misc.h" #include "m_random.h" #include "s_sound.h" #include "i_swap.h" @@ -1682,7 +1683,7 @@ static int CmdEndPrintBold(void) static int CmdPrintString(void) { - strcat(PrintBuffer, ACStrings[Pop()]); + M_StringConcat(PrintBuffer, ACStrings[Pop()], sizeof(PrintBuffer)); return SCRIPT_CONTINUE; } @@ -1690,8 +1691,8 @@ static int CmdPrintNumber(void) { char tempStr[16]; - sprintf(tempStr, "%d", Pop()); - strcat(PrintBuffer, tempStr); + snprintf(tempStr, sizeof(tempStr), "%d", Pop()); + M_StringConcat(PrintBuffer, tempStr, sizeof(PrintBuffer)); return SCRIPT_CONTINUE; } -- cgit v1.2.3