From e3968cdf65b8076f3f8e8d6516d04b1075cd07a3 Mon Sep 17 00:00:00 2001 From: glx22 Date: Tue, 23 Aug 2022 16:50:59 +0200 Subject: [PATCH] Fix #9974, aa5a8fe: strftime buffer maxsize is off by one strftime() return value doesn't count NULL character, but buffer size must include it. --- src/walltime_func.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/walltime_func.h b/src/walltime_func.h index f070d8e2b9..216a726662 100644 --- a/src/walltime_func.h +++ b/src/walltime_func.h @@ -65,7 +65,7 @@ struct Time { #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wformat-nonliteral" #endif /* _MSC_VER */ - return strftime(buffer, last - buffer, format, &time_struct); + return strftime(buffer, last - buffer + 1, format, &time_struct); #ifndef _MSC_VER #pragma GCC diagnostic pop #endif /* _MSC_VER */