1
0
forked from aniani/vim

patch 8.2.2787: MS-Windows: crash when using :echoconsole

Problem:    MS-Windows: crash when using :echoconsole.
Solution:   Do not write a NUL when it's already there.
This commit is contained in:
Bram Moolenaar
2021-04-20 10:33:28 +02:00
parent 4f2df37a0d
commit 6d4c1c7ba8
2 changed files with 6 additions and 2 deletions

View File

@@ -6411,7 +6411,9 @@ mch_write(
return;
# endif
s[len] = NUL;
// Avoid writing to a string literal.
if (s[len] != NUL)
s[len] = NUL;
if (!term_console)
{
@@ -6433,7 +6435,7 @@ mch_write(
return;
}
while((ch = s[++prefix]))
while ((ch = s[++prefix]))
if (ch <= 0x1e && !(ch != '\n' && ch != '\r' && ch != '\b'
&& ch != '\a' && ch != '\033'))
break;