Permalink
Browse files

patch 8.0.0852: MS-Windows: possible crash when giving a message on s…

…tartup

Problem:    MS-Windows: possible crash when giving a message on startup.
Solution:   Initialize length. (Yasuhiro Matsumoto, closes #1931)
  • Loading branch information...
brammool committed Aug 3, 2017
1 parent 69a76fe commit 1b66c00aeca87913e75012c59c4e969316e2626d
Showing with 7 additions and 4 deletions.
  1. +5 −4 src/message.c
  2. +2 −0 src/version.c
View
@@ -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;
}
View
@@ -769,6 +769,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
852,
/**/
851,
/**/

0 comments on commit 1b66c00

Please sign in to comment.