glibc's vswprintf doesn't nul terminate on truncation.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@40901 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Michael Wetherell 2006-08-28 15:35:25 +00:00
parent 10b7d13cdb
commit 8dd57590c2

View File

@ -1470,6 +1470,10 @@ int wxSnprintf( wxChar *str, size_t size, const wxChar *format, ... )
int ret = vswprintf( str, size, wxFormatConverter(format), argptr );
// VsnprintfTestCase reveals that glibc's implementation of vswprintf
// doesn't nul terminate on truncation.
str[size - 1] = 0;
va_end(argptr);
return ret;