Skip to content

Commit 8e8bc07

Browse files
author
Proger_XP
committed
Merge branch 'master' of github.com:ProgerXP/Notepad2e
2 parents 9f84db8 + ac4b27c commit 8e8bc07

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Extension/StringRecoding.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ void TextBuffer_NormalizeBeforeEncode(RecodingAlgorithm* pRA, TextBuffer* pTB, l
225225
int cbDataWide = (pTB->m_iMaxPos + 1) * sizeof(WCHAR);
226226
LPWSTR lpDataWide = n2e_Alloc(cbDataWide);
227227
cbDataWide = MultiByteToWideChar(CP_UTF8, 0, pTB->m_ptr, pTB->m_iMaxPos, lpDataWide, cbDataWide / sizeof(WCHAR)) * sizeof(WCHAR);
228-
lpDataWide[pTB->m_iMaxPos] = 0;
228+
lpDataWide[cbDataWide / sizeof(WCHAR)] = 0;
229229

230230
#define INVALID_UNICODE_CHAR 0xFFFD
231231
LPWSTR lpInvalidCharPos = wcschr(lpDataWide, INVALID_UNICODE_CHAR);

0 commit comments

Comments
 (0)