From 9cb43f988327984a98d7a72c8ab32a72996f71f0 Mon Sep 17 00:00:00 2001 From: XMRig Date: Fri, 29 Mar 2019 17:22:25 +0700 Subject: [PATCH] Fix log. --- src/base/io/log/Log.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/base/io/log/Log.cpp b/src/base/io/log/Log.cpp index 4a2a8de6..487cd9b8 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);