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.
diff --git a/src/os_win32.c b/src/os_win32.c
index 7c2051f..9b692ec 100644
--- a/src/os_win32.c
+++ b/src/os_win32.c
@@ -6411,7 +6411,9 @@
 	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 @@
 	    return;
 	}
 
-	while((ch = s[++prefix]))
+	while ((ch = s[++prefix]))
 	    if (ch <= 0x1e && !(ch != '\n' && ch != '\r' && ch != '\b'
 						&& ch != '\a' && ch != '\033'))
 		break;