diff --git a/gpr2gpa/gpr2gpa.cpp b/gpr2gpa/gpr2gpa.cpp index d1f4def..2f9c4e1 100644 --- a/gpr2gpa/gpr2gpa.cpp +++ b/gpr2gpa/gpr2gpa.cpp @@ -98,6 +98,11 @@ void AppendFmt(std::vector &array, const char *fmt, ...) if (resultSize <= 0) return; + // vsnprintf invalidates the va_list, so we need to + // reinit args so the next call doesn't print garbage. + va_end(args); + va_start(args, fmt); + size_t appendSize = static_cast(resultSize); if (SIZE_MAX == appendSize)