diff --git a/src/base/io/log/Log.cpp b/src/base/io/log/Log.cpp index 4a2a8de6e..487cd9b85 100644 --- a/src/base/io/log/Log.cpp +++ b/src/base/io/log/Log.cpp @@ -93,12 +93,12 @@ public: timestamp(level, size, offset); color(level, size); - int rc = vsnprintf(m_buf + size, sizeof (m_buf) - offset - 32, fmt, args); + const int rc = vsnprintf(m_buf + size, sizeof (m_buf) - offset - 32, fmt, args); if (rc < 0) { return unlock(); } - size += static_cast(rc); + size += std::min(static_cast(rc), sizeof (m_buf) - offset - 32); endl(size); std::string txt(m_buf);