From aae15a05fbe7a1147521a8c5b0ccdfd5ce8ee675 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Sat, 30 Nov 2024 09:50:26 +0100 Subject: [PATCH] added using empty buffer to determine required size for vsnprintf --- src/libgame/misc.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/libgame/misc.c b/src/libgame/misc.c index e12daa8e..40e76611 100644 --- a/src/libgame/misc.c +++ b/src/libgame/misc.c @@ -1253,12 +1253,11 @@ 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_test); + int size = vsnprintf(NULL, 0, format, ap_test); va_end(ap_test); -- 2.34.1