X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e21011866e9a89b5abda727f80e666ed2d7041c7..a47391f3f9cceb68fb65cdf2bfef7f98a308fd23:/src/common/string.cpp diff --git a/src/common/string.cpp b/src/common/string.cpp index 76a89a88a3..503ff915c9 100644 --- a/src/common/string.cpp +++ b/src/common/string.cpp @@ -504,8 +504,7 @@ size_t wxStringBase::rfind(const wxStringBase& str, size_t nStart) const { return cursor - c_str(); } - --cursor; - } while ( cursor > c_str() ); + } while ( cursor-- > c_str() ); } return npos; @@ -1686,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;