Fix a buffer overrun in ssprintf.

pull/97/head
whitequark 2016-10-11 23:01:20 +00:00
parent ffa104602c
commit e80a3a0a71
1 changed files with 2 additions and 1 deletions

View File

@ -16,12 +16,13 @@ std::string SolveSpace::ssprintf(const char *fmt, ...)
va_end(va);
std::string result;
result.resize(size);
result.resize(size + 1);
va_start(va, fmt);
vsnprintf(&result[0], size + 1, fmt, va);
va_end(va);
result.resize(size);
return result;
}