From 8dd57590c293c2646c5bca5d3c885169b8964ecd Mon Sep 17 00:00:00 2001 From: Michael Wetherell Date: Mon, 28 Aug 2006 15:35:25 +0000 Subject: [PATCH] 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 --- src/common/wxchar.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/common/wxchar.cpp b/src/common/wxchar.cpp index 089d645b82..5e92ae1962 100644 --- a/src/common/wxchar.cpp +++ b/src/common/wxchar.cpp @@ -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; -- 2.45.2