X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d6718dd17be552c69c7e4dbca183f6078998c042..0d203f875d421cb42ee07a2c2bc59186877ef15b:/src/common/string.cpp diff --git a/src/common/string.cpp b/src/common/string.cpp index e7ab5d2615..8f20b9ac13 100644 --- a/src/common/string.cpp +++ b/src/common/string.cpp @@ -1815,9 +1815,11 @@ int wxString::PrintfV(const wxChar* pszFormat, va_list argptr) // current size of the buffer size *= 2; } - else if ( len > size ) + else if ( len >= size ) { - size = len; + // some vsnprintf() implementations NUL-terminate the buffer and + // some don't in len == size case, to be safe always add 1 + size = len + 1; } else // ok, there was enough space {