From: Francesco Chemolli <5175948+kinkie@users.noreply.github.com> Date: Tue, 3 Jun 2025 12:29:30 +0000 (+0000) Subject: Fix OpenSSL build with GCC v15.1.1 [-Wformat-truncation=] (#2077) X-Git-Tag: SQUID_7_0_2~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ec81366351b9f2ad2d1a83c33a595693fc3659d1;p=thirdparty%2Fsquid.git Fix OpenSSL build with GCC v15.1.1 [-Wformat-truncation=] (#2077) On arm64 Fedora 42: src/ssl/crtd_message.cc:132:39: error: '%zd' directive output may be truncated writing between 1 and 19 bytes into a region of size 10 [-Werror=format-truncation=] snprintf(buffer, sizeof(buffer), "%zd", body.length()); --- diff --git a/src/ssl/crtd_message.cc b/src/ssl/crtd_message.cc index 84f9d181f6..0fd518dabc 100644 --- a/src/ssl/crtd_message.cc +++ b/src/ssl/crtd_message.cc @@ -128,9 +128,7 @@ void Ssl::CrtdMessage::setCode(std::string const & aCode) { code = aCode; } std::string Ssl::CrtdMessage::compose() const { if (code.empty()) return std::string(); - char buffer[10]; - snprintf(buffer, sizeof(buffer), "%zd", body.length()); - return code + ' ' + buffer + ' ' + body; + return code + ' ' + std::to_string(body.length()) + ' ' + body; } void Ssl::CrtdMessage::clear()