From f695a4eac631e081ac3791d39537e3f7f641417b Mon Sep 17 00:00:00 2001 From: pgdalmeida Date: Thu, 17 Sep 2026 18:20:25 +0200 Subject: [PATCH] Give the UTC stamp a buffer GCC can prove is big enough --- src/core/Application.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/core/Application.cpp b/src/core/Application.cpp index 2587f65..c695436 100644 --- a/src/core/Application.cpp +++ b/src/core/Application.cpp @@ -95,7 +95,13 @@ std::string utcStampNow() { #else gmtime_r(&t, &tm); #endif - char b[32]; + // 64, not 32, purely to keep the compiler quiet. The real output is always 17 + // characters, but the tm fields are plain ints, so GCC cannot rule out a + // nonsense clock and computes a worst case of 61 bytes - warning on every + // build. snprintf truncates rather than overflows either way, so this was + // never a safety problem; a recurring warning that everyone learns to ignore + // is the actual cost. + char b[64]; std::snprintf(b, sizeof(b), "%04d-%02d-%02dT%02d:%02dZ", tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min); return std::string(b);