Browse Source

Fix format-truncation warning.

adaptive-webui-19844
sledgehammer999 8 years ago
parent
commit
d3ccbe4f86
No known key found for this signature in database
GPG Key ID: 6E4A2D025B7CC9A2
  1. 3
      src/base/net/smtp.cpp

3
src/base/net/smtp.cpp

@ -528,7 +528,8 @@ QString Smtp::getCurrentDateTime() const @@ -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;

Loading…
Cancel
Save