Merge pull request #66 from Zeex/logformat-fix

Fix invalid buffer length in logFormat()
This commit is contained in:
Petr Kobalicek
2015-01-09 01:08:32 +01:00

View File

@@ -45,9 +45,12 @@ void Logger::logFormat(uint32_t style, const char* fmt, ...) {
va_list ap;
va_start(ap, fmt);
len = vsnprintf(buf, 1023, fmt, ap);
len = vsnprintf(buf, sizeof(buf), fmt, ap);
va_end(ap);
if (len >= sizeof(buf))
len = sizeof(buf) - 1;
logString(style, buf, len);
}