Fixed WLog_PrintMessagePrefixVA

WLog_PrintMessagePrefixVA is called with format being a stack variable.
Always copy the data to message->PrefixString otherwise the information
will be lost whenever the stack is destroyed.
This commit is contained in:
Armin Novak 2017-03-03 13:49:29 +01:00
parent 88b6ff00d9
commit b574e196d9

View File

@ -45,19 +45,15 @@ extern const char* WLOG_LEVELS[7];
* Log Layout
*/
void WLog_PrintMessagePrefixVA(wLog* log, wLogMessage* message, const char* format, va_list args)
static void WLog_PrintMessagePrefixVA(wLog* log, wLogMessage* message, const char* format, va_list args)
{
if (!strchr(format, '%'))
{
message->PrefixString = (LPSTR) format;
}
sprintf_s(message->PrefixString, WLOG_MAX_PREFIX_SIZE - 1, format);
else
{
wvsnprintfx(message->PrefixString, WLOG_MAX_PREFIX_SIZE - 1, format, args);
}
}
void WLog_PrintMessagePrefix(wLog* log, wLogMessage* message, const char* format, ...)
static void WLog_PrintMessagePrefix(wLog* log, wLogMessage* message, const char* format, ...)
{
va_list args;
va_start(args, format);