X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/78e6050be8686ba15a6969aedf434a18f59cc6ee..1857c88d2624f37590be3b13c33f5cf9449e7a3b:/src/common/string.cpp diff --git a/src/common/string.cpp b/src/common/string.cpp index 8415f0c3f3..f0cb6d2910 100644 --- a/src/common/string.cpp +++ b/src/common/string.cpp @@ -168,6 +168,8 @@ wxSTD ostream& operator<<(wxSTD ostream& os, const wxString& str) #define STATISTICS_ADD(av, val) #endif // WXSTRING_STATISTICS +#if !wxUSE_STL + // =========================================================================== // wxStringData class deallocation // =========================================================================== @@ -180,8 +182,6 @@ void wxStringData::Free() } #endif -#if !wxUSE_STL - // =========================================================================== // wxStringBase // =========================================================================== @@ -1685,7 +1685,10 @@ int wxString::PrintfV(const wxChar* pszFormat, va_list argptr) buf[size] = _T('\0'); } - if ( len >= 0 ) + // vsnprintf() may return either -1 (traditional Unix behaviour) or the + // total number of characters which would have been written if the + // buffer were large enough + if ( len >= 0 && len <= size ) { // ok, there was enough space break;