From 1063cd224d9d02d60445735c83e008e311473550 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Sat, 30 Nov 2024 09:46:08 +0100 Subject: [PATCH] fixed crash bug caused by using va_list twice --- src/libgame/misc.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/libgame/misc.c b/src/libgame/misc.c index 599879eb..e12daa8e 100644 --- a/src/libgame/misc.c +++ b/src/libgame/misc.c @@ -1252,10 +1252,15 @@ char *getStringToLower(const char *s) static char *getStringVPrint(char *format, va_list ap) { + va_list ap_test; char test[1]; + va_copy(ap_test, ap); + // determine required size of string to be printed - int size = vsnprintf(test, 1, format, ap); + int size = vsnprintf(test, 1, format, ap_test); + + va_end(ap_test); // check if something went wrong (should not happen) if (size < 0) -- 2.34.1