From d3ccbe4f86c7060eb4c973651c0a723eb9ddc0a5 Mon Sep 17 00:00:00 2001 From: sledgehammer999 Date: Thu, 1 Jun 2017 01:08:06 +0300 Subject: [PATCH] Fix format-truncation warning. --- src/base/net/smtp.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/base/net/smtp.cpp b/src/base/net/smtp.cpp index fc5810aef..fcc35b2e3 100644 --- a/src/base/net/smtp.cpp +++ b/src/base/net/smtp.cpp @@ -528,7 +528,8 @@ QString Smtp::getCurrentDateTime() const int timeOffsetHour = nowDateTime.secsTo(tmp) / 3600; int timeOffsetMin = nowDateTime.secsTo(tmp) / 60 - (60 * timeOffsetHour); int timeOffset = timeOffsetHour * 100 + timeOffsetMin; - char buf[6] = {0}; + // buf size = 11 to avoid format truncation warnings from snprintf + char buf[11] = {0}; std::snprintf(buf, sizeof(buf), "%+05d", timeOffset); QString timeOffsetStr = buf;