diff --git "a/dll/win32/riched20/editor.c" "b/dll/win32/riched20/editor.c" index a7794ab7901..e744da0f938 100644 --- "a/dll/win32/riched20/editor.c" +++ "b/dll/win32/riched20/editor.c" @@ -4362,7 +4362,17 @@ int ME_GetTextW(ME_TextEditor *editor, WCHAR *buffer, int buflen, *buffer = '\r'; buffer ++; } + +#ifdef __REACTOS__ + /* Do not write past the end of the buffer */ + if ((INT_PTR)buffer < (INT_PTR)pStart + nLen * sizeof(WCHAR) + sizeof(WCHAR)) + { + *buffer = 0; + } +#else *buffer = 0; +#endif + return buffer - pStart; }