Fix format-truncation warning.

This commit is contained in:
sledgehammer999 2017-06-01 01:08:06 +03:00
parent 70d0fb741f
commit d3ccbe4f86
No known key found for this signature in database
GPG key ID: 6E4A2D025B7CC9A2

View file

@ -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;