From: Vadim Zeitlin Date: Wed, 5 Apr 2006 15:18:05 +0000 (+0000) Subject: properly NUL-terminate the output in wxMBConvUTF16swap::WC2MB() X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/64f56529a899785384e1d7e30b105bc4ce3ea951 properly NUL-terminate the output in wxMBConvUTF16swap::WC2MB() git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38575 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/common/strconv.cpp b/src/common/strconv.cpp index 3670582926..80a0248e97 100644 --- a/src/common/strconv.cpp +++ b/src/common/strconv.cpp @@ -991,8 +991,11 @@ size_t wxMBConvUTF16swap::WC2MB(char *buf, const wchar_t *psz, size_t n) const psz++; } - if ( buf && len < n ) - *buf = '\0'; + if ( buf && len < n - 1 ) + { + buf[0] = + buf[1] = '\0'; + } return len; }