From 0582856b8478c2223ebfb8ce6c9b0d5cd0ba071b Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Sat, 20 Jul 2024 22:17:44 +0200 Subject: [PATCH] Fixed an issue where formatting translation strings could lead to crashes on some platforms --- es-core/src/utils/StringUtil.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/es-core/src/utils/StringUtil.cpp b/es-core/src/utils/StringUtil.cpp index 568338183..25371b834 100644 --- a/es-core/src/utils/StringUtil.cpp +++ b/es-core/src/utils/StringUtil.cpp @@ -647,8 +647,10 @@ namespace Utils va_copy(copy, args); const int length {vsnprintf(nullptr, 0, &stringArg[0], copy)}; + va_end(copy); std::string buffer(length, '\0'); + va_copy(copy, args); vsnprintf(&buffer[0], length + 1, &stringArg[0], copy); va_end(copy);