From d684e8ca9d16b2665b0623ba77c709183ba8ca02 Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Tue, 27 Jan 2026 13:30:08 -0400 Subject: [PATCH] MT#62181 silence compiler warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit src/XmlRpcValue.cpp: In member function ‘std::ostream& XmlRpc::XmlRpcValue::write(std::ostream&) const’: src/XmlRpcValue.cpp:483:44: warning: ‘%02d’ directive output may be truncated writing between 2 and 11 bytes into a region of size between 8 and 15 [-Wformat-truncation=] 483 | snprintf(buf, sizeof(buf)-1, "%4d%02d%02dT%02d:%02d:%02d", | ^~~~ src/XmlRpcValue.cpp:483:40: note: directive argument in the range [-2147483647, 2147483647] 483 | snprintf(buf, sizeof(buf)-1, "%4d%02d%02dT%02d:%02d:%02d", | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/XmlRpcValue.cpp:483:19: note: ‘snprintf’ output between 18 and 70 bytes into a destination of size 19 483 | snprintf(buf, sizeof(buf)-1, "%4d%02d%02dT%02d:%02d:%02d", | ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 484 | (1900 + t.tm_year), (1 + t.tm_mon), t.tm_mday, t.tm_hour, t.tm_min, t.tm_sec); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Change-Id: I38edb330bc0d0ea17fc215f745fc51e66d56d41f --- apps/xmlrpc2di/xmlrpc++/src/XmlRpcValue.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/xmlrpc2di/xmlrpc++/src/XmlRpcValue.cpp b/apps/xmlrpc2di/xmlrpc++/src/XmlRpcValue.cpp index fbec7ee8..5591fd52 100644 --- a/apps/xmlrpc2di/xmlrpc++/src/XmlRpcValue.cpp +++ b/apps/xmlrpc2di/xmlrpc++/src/XmlRpcValue.cpp @@ -479,7 +479,7 @@ namespace XmlRpc { case TypeDateTime: { const tm& t = std::get(_value); - char buf[20]; + char buf[64]; snprintf(buf, sizeof(buf)-1, "%4d%02d%02dT%02d:%02d:%02d", (1900 + t.tm_year), (1 + t.tm_mon), t.tm_mday, t.tm_hour, t.tm_min, t.tm_sec); buf[sizeof(buf)-1] = 0;