Fix crash in stl_vsprintf() from reusing va_list

develop
lethosor 2017-07-13 13:07:58 -04:00
parent 48a61420b7
commit ce1158780f
1 changed files with 4 additions and 1 deletions

@ -61,7 +61,10 @@ std::string stl_vsprintf(const char *fmt, va_list args) {
std::vector<char> buf; std::vector<char> buf;
buf.resize(4096); buf.resize(4096);
for (;;) { for (;;) {
int rsz = vsnprintf(&buf[0], buf.size(), fmt, args); va_list args2;
va_copy(args2, args);
int rsz = vsnprintf(&buf[0], buf.size(), fmt, args2);
va_end(args2);
if (rsz < 0) if (rsz < 0)
buf.resize(buf.size()*2); buf.resize(buf.size()*2);