X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/78e6050be8686ba15a6969aedf434a18f59cc6ee..a47391f3f9cceb68fb65cdf2bfef7f98a308fd23:/src/common/string.cpp diff --git a/src/common/string.cpp b/src/common/string.cpp index 8415f0c3f3..503ff915c9 100644 --- a/src/common/string.cpp +++ b/src/common/string.cpp @@ -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;