From ec81366351b9f2ad2d1a83c33a595693fc3659d1 Mon Sep 17 00:00:00 2001 From: Francesco Chemolli <5175948+kinkie@users.noreply.github.com> Date: Tue, 3 Jun 2025 12:29:30 +0000 Subject: [PATCH] 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()); --- src/ssl/crtd_message.cc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) 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() -- 2.47.2