UI: Fix non-Windows vstrprintf

vsnprintf is called twice; one call must use args, and one must use
args2 (which is how it was supposed to be from the beginning). Each call
"consumes" its va_list parameter, so they each need to use a separate
copy. Fixes potential corruption and/or crashing when calling vsnprintf.
This commit is contained in:
Jim 2022-09-09 23:25:31 -07:00
parent db766273b6
commit 646d47aacb

View file

@ -14,7 +14,7 @@ std::string vstrprintf(const char *format, va_list args)
std::string str;
int size = (int)vsnprintf(nullptr, 0, format, args2) + 1;
str.resize(size);
vsnprintf(&str[0], size, format, args2);
vsnprintf(&str[0], size, format, args);
va_end(args2);