fix logger crash (#136)

make logger don't crash when long messages put to logger. Currently longest message is 1024 chars. Longer messages are truncated
This commit is contained in:
redPanther 2016-07-21 20:12:51 +02:00 committed by GitHub
parent fff42f370c
commit a930d4e403
1 changed files with 3 additions and 3 deletions

View File

@ -122,11 +122,11 @@ void Logger::Message(LogLevel level, const char* sourceFile, const char* func, u
|| (GLOBAL_MIN_LOG_LEVEL > Logger::UNSET && level < GLOBAL_MIN_LOG_LEVEL) ) // global level set, use global level
return;
char msg[512];
const size_t max_msg_length = 1024;
char msg[max_msg_length];
va_list args;
va_start (args, fmt);
vsprintf (msg,fmt, args);
vsnprintf (msg, max_msg_length, fmt, args);
va_end (args);
std::string location;