(svn r26776) -Codechange: use safe string functions in script/squirrel*.cpp
This commit is contained in:
@@ -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;
|
||||
|
Reference in New Issue
Block a user