added wxVaCopy() and use it to fix wxVsnprintf() crash (see bug 1017651)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29604 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2004-10-02 18:32:31 +00:00
parent ebb97a41da
commit d85cfb3784
3 changed files with 64 additions and 1 deletions

View File

@@ -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