summaryrefslogtreecommitdiff
path: root/src/os_win32.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/os_win32.c')
-rw-r--r--src/os_win32.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/os_win32.c b/src/os_win32.c
index 7c2051f7f..9b692ec0e 100644
--- a/src/os_win32.c
+++ b/src/os_win32.c
@@ -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;