]> git.saurik.com Git - wxWidgets.git/commitdiff
glibc's vswprintf doesn't nul terminate on truncation.
authorMichael Wetherell <mike.wetherell@ntlworld.com>
Mon, 28 Aug 2006 15:35:25 +0000 (15:35 +0000)
committerMichael Wetherell <mike.wetherell@ntlworld.com>
Mon, 28 Aug 2006 15:35:25 +0000 (15:35 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@40901 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/wxchar.cpp

index 089d645b8272c2d2b13162b0c93ea2243fe32207..5e92ae19627bca67c82fa4149e92535ae866fca7 100644 (file)
@@ -1470,6 +1470,10 @@ int wxSnprintf( wxChar *str, size_t size, const wxChar *format, ... )
 
     int ret = vswprintf( str, size, wxFormatConverter(format), argptr );
 
 
     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;
     va_end(argptr);
 
     return ret;