From: Holger Schemel Date: Sat, 30 Nov 2024 08:50:26 +0000 (+0100) Subject: added using empty buffer to determine required size for vsnprintf X-Git-Tag: 4.4.0.0-test-4~12 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=aae15a05fbe7a1147521a8c5b0ccdfd5ce8ee675;p=rocksndiamonds.git added using empty buffer to determine required size for vsnprintf --- 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);