summaryrefslogtreecommitdiff
path: root/src/script/squirrel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/script/squirrel.cpp')
-rw-r--r--src/script/squirrel.cpp13
1 files changed, 3 insertions, 10 deletions
diff --git a/src/script/squirrel.cpp b/src/script/squirrel.cpp
index bfffc5c3d..22e5354b6 100644
--- a/src/script/squirrel.cpp
+++ b/src/script/squirrel.cpp
@@ -19,14 +19,7 @@
#include <../squirrel/sqpcheader.h>
#include <../squirrel/sqvm.h>
-/* Due to the different characters for Squirrel, the scsnprintf might be a simple
- * snprint which triggers the safeguard. But it isn't always a simple snprintf.
- * Likewise for scvsnprintf and scstrcat.
- * TODO: use properly safe functions now that Squirrel uses chars exclusively. */
#include "../safeguards.h"
-#undef snprintf
-#undef vsnprintf
-#undef strcat
void Squirrel::CompileError(HSQUIRRELVM vm, const SQChar *desc, const SQChar *source, SQInteger line, SQInteger column)
{
@@ -51,7 +44,7 @@ void Squirrel::ErrorPrintFunc(HSQUIRRELVM vm, const SQChar *s, ...)
SQChar buf[1024];
va_start(arglist, s);
- vsnprintf(buf, lengthof(buf), s, arglist);
+ vseprintf(buf, lastof(buf), s, arglist);
va_end(arglist);
/* Check if we have a custom print function */
@@ -107,9 +100,9 @@ void Squirrel::PrintFunc(HSQUIRRELVM vm, const SQChar *s, ...)
SQChar buf[1024];
va_start(arglist, s);
- vsnprintf(buf, lengthof(buf) - 2, s, arglist);
+ vseprintf(buf, lastof(buf) - 2, s, arglist);
va_end(arglist);
- strcat(buf, "\n");
+ strecat(buf, "\n", lastof(buf));
/* Check if we have a custom print function */
SQPrintFunc *func = ((Squirrel *)sq_getforeignptr(vm))->print_func;