From 7dcf004f0ee3282dcdc14c59e82d36f9ffef6c64 Mon Sep 17 00:00:00 2001 From: rlbxku1r <32811754+rlbxku1r@users.noreply.github.com> Date: Mon, 27 Sep 2021 00:21:03 +0900 Subject: [PATCH] wxMBConv_iconv: Fix wrong buffer size This is an oversight in commit 878c265. --- src/common/strconv.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/common/strconv.cpp b/src/common/strconv.cpp index 3cf9169934..84e96e5fc4 100644 --- a/src/common/strconv.cpp +++ b/src/common/strconv.cpp @@ -2343,13 +2343,13 @@ wxMBConv_iconv::ToWChar(wchar_t *dst, size_t dstLen, do { char* bufPtr = (char*)tbuf; - dstLen = 8 * SIZEOF_WCHAR_T; + dstLen = sizeof(tbuf); cres = iconv(m2w, ICONV_CHAR_CAST(&pszPtr), &srcLen, &bufPtr, &dstLen ); - res += 8 - (dstLen / SIZEOF_WCHAR_T); + res += (sizeof(tbuf) - dstLen) / SIZEOF_WCHAR_T; } while ((cres == (size_t)-1) && (errno == E2BIG)); }