diff options
-rw-r--r-- | src/log.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/log.cpp b/src/log.cpp index 5880e108..4ce1cd83 100644 --- a/src/log.cpp +++ b/src/log.cpp @@ -61,12 +61,13 @@ void Logger::setLogFile(const std::string &logFilename) void Logger::log(const char *log_text, ...) { - char* buf = new char[1024]; + const size_t bufSize = 1024; + char* buf = new char[bufSize]; va_list ap; // Use a temporary buffer to fill in the variables va_start(ap, log_text); - vsprintf(buf, log_text, ap); + vsnprintf(buf, bufSize, log_text, ap); va_end(ap); // Get the current system time |