mirror of
https://github.com/obsproject/obs-studio.git
synced 2024-07-15 07:44:10 +00:00
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:
parent
db766273b6
commit
646d47aacb
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue