From a0ec2ec9d556a28bb26c8572bdc9b09de0ccde3f Mon Sep 17 00:00:00 2001 From: proddy Date: Sun, 22 Nov 2020 16:15:18 +0100 Subject: [PATCH] fix for out of bound --- lib/uuid-log/src/format_timestamp_ms.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/uuid-log/src/format_timestamp_ms.cpp b/lib/uuid-log/src/format_timestamp_ms.cpp index 4cb977a5f..0c59c1ffa 100644 --- a/lib/uuid-log/src/format_timestamp_ms.cpp +++ b/lib/uuid-log/src/format_timestamp_ms.cpp @@ -45,7 +45,7 @@ std::string format_timestamp_ms(uint64_t timestamp_ms, unsigned int days_width) milliseconds = timestamp_ms; - std::vector text(10 + 1 /* days */ + 2 + 1 /* hours */ + 2 + 1 /* minutes */ + 2 + 1 /* seconds */ + 3 /* milliseconds */ + 1); + static std::vector text(10 + 1 /* days */ + 2 + 1 /* hours */ + 2 + 1 /* minutes */ + 2 + 1 /* seconds */ + 3 /* milliseconds */ + 1); snprintf_P(text.data(), text.size(), PSTR("%0*lu+%02u:%02u:%02u.%03u"), std::min(days_width, 10U), days, hours, minutes, seconds, milliseconds);