# HG changeset patch # User Christian Brabandt # Date 1501779605 -7200 # Node ID f37815bb7417117b5099d061622884c19bdfbd5d # Parent 60014330374dfb635c7d2c230b76de6d488303d6 patch 8.0.0852: MS-Windows: possible crash when giving a message on startup commit https://github.com/vim/vim/commit/1b66c00aeca87913e75012c59c4e969316e2626d Author: Bram Moolenaar Date: Thu Aug 3 18:55:00 2017 +0200 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 https://github.com/vim/vim/issues/1931) diff --git a/src/message.c b/src/message.c --- a/src/message.c +++ b/src/message.c @@ -2639,13 +2639,14 @@ msg_puts_printf(char_u *str, int maxlen) # 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 --- a/src/version.c +++ b/src/version.c @@ -770,6 +770,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 852, +/**/ 851, /**/ 850,