From 65de25c67e36da2cc3437f111e36f8c03fae61ff Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Fri, 22 May 2026 19:06:43 +0200 Subject: [PATCH] Avoid false buffer overflow warning in GCC 11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit GCC 11 can’t prove PRIu64 won’t expand beyond two digits, so we switch this formatter to bounded unsigned int fields (%02u) after clamping logic. --- client/src/cmdhfmfu.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/client/src/cmdhfmfu.c b/client/src/cmdhfmfu.c index 7f4aac223..45690507e 100644 --- a/client/src/cmdhfmfu.c +++ b/client/src/cmdhfmfu.c @@ -5050,16 +5050,16 @@ static uint64_t mfulc_desbrute_tdea2_dec_ip(uint64_t ip_block, const uint64_t k1 } static void mfulc_desbrute_format_duration(uint64_t seconds, char *buf, size_t buflen) { - uint64_t h = seconds / 3600; - uint64_t m = (seconds / 60) % 60; - uint64_t s = seconds % 60; + unsigned int h = (unsigned int)(seconds / 3600); + unsigned int m = (unsigned int)((seconds / 60) % 60); + unsigned int s = (unsigned int)(seconds % 60); if (h > 99) { snprintf(buf, buflen, ">99h"); } else if (h > 0) { - snprintf(buf, buflen, "%02" PRIu64 ":%02" PRIu64 ":%02" PRIu64, h, m, s); + snprintf(buf, buflen, "%02u:%02u:%02u", h, m, s); } else { - snprintf(buf, buflen, "%02" PRIu64 ":%02" PRIu64, m, s); + snprintf(buf, buflen, "%02u:%02u", m, s); } }