diff --git "a/dll/win32/riched20/editor.c" "b/dll/win32/riched20/editor.c" index a7794ab7901..65982439d4f 100644 --- "a/dll/win32/riched20/editor.c" +++ "b/dll/win32/riched20/editor.c" @@ -4357,7 +4357,7 @@ int ME_GetTextW(ME_TextEditor *editor, WCHAR *buffer, int buflen, str = get_text( run, 0 ); } /* append '\r' to the last paragraph. */ - if (run == para_end_run( para_prev( editor_end_para( editor ) ) ) && bEOP) + if (run == para_end_run( para_prev( editor_end_para( editor ) ) ) && bEOP && buflen) { *buffer = '\r'; buffer ++;