]> git.saurik.com Git - wxWidgets.git/commitdiff
fix for C99-compatible vsnprintf()
authorVadim Zeitlin <vadim@wxwidgets.org>
Thu, 11 Sep 2003 20:27:39 +0000 (20:27 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Thu, 11 Sep 2003 20:27:39 +0000 (20:27 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@23531 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/string.cpp

index 8415f0c3f31e56562a50012a959b7faab0231f78..503ff915c9da4de181590e9091c97d06727f3ed7 100644 (file)
@@ -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;