patch 8.0.0852: MS-Windows: possible crash when giving a message on startup
Problem: MS-Windows: possible crash when giving a message on startup.
Solution: Initialize length. (Yasuhiro Matsumoto, closes #1931)
diff --git a/src/message.c b/src/message.c
index 9a4a32f..e548fc0 100644
--- a/src/message.c
+++ b/src/message.c
@@ -2639,13 +2639,14 @@
# if defined(FEAT_MBYTE) && !defined(FEAT_GUI_MSWIN)
if (enc_codepage >= 0 && (int)GetConsoleCP() != enc_codepage)
{
- int len;
- WCHAR *widestr = (WCHAR *)enc_to_utf16(str, &len);
+ int inlen = STRLEN(str);
+ int outlen;
+ WCHAR *widestr = (WCHAR *)enc_to_utf16(str, &inlen);
if (widestr != NULL)
{
- WideCharToMultiByte_alloc(GetConsoleCP(), 0, widestr, len,
- (LPSTR *)&ccp, &len, 0, 0);
+ WideCharToMultiByte_alloc(GetConsoleCP(), 0, widestr, inlen,
+ (LPSTR *)&ccp, &outlen, 0, 0);
vim_free(widestr);
s = str = ccp;
}
diff --git a/src/version.c b/src/version.c
index a5a3d68..a029dd5 100644
--- a/src/version.c
+++ b/src/version.c
@@ -770,6 +770,8 @@
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 852,
+/**/
851,
/**/
850,