From: Vadim Zeitlin Date: Thu, 11 Sep 2003 20:27:39 +0000 (+0000) Subject: fix for C99-compatible vsnprintf() X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/caff62f22d16af7350d86151929dae99ebb36182?ds=inline fix for C99-compatible vsnprintf() git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@23531 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- 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;