deal correctly with vsnprintf() implementations which always NUL-terminate the buffer, even if there is not enough space (recent glibc ones do it like this)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42620 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
f4eadf6136
commit
64f8f94ca0
@ -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
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user