X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/cf6bedce0ee2453abe58437cdea45b8ff16f4d01..57c26f8210c40317d70d616a05198e042ee9175b:/src/common/string.cpp diff --git a/src/common/string.cpp b/src/common/string.cpp index f42bd4dfd4..07a532d180 100644 --- a/src/common/string.cpp +++ b/src/common/string.cpp @@ -1727,7 +1727,12 @@ int wxString::PrintfV(const wxChar* pszFormat, va_list argptr) return -1; } - len = wxVsnprintf(buf, size, pszFormat, argptr); + // wxVsnprintf() may modify the original arg pointer, so pass it + // only a copy + va_list argptrcopy; + wxVaCopy(argptrcopy, argptr); + len = wxVsnprintf(buf, size, pszFormat, argptrcopy); + va_end(argptrcopy); // some implementations of vsnprintf() don't NUL terminate // the string if there is not enough space for it so