mirror of
https://github.com/vim/vim.git
synced 2025-09-23 03:43:49 -04:00
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)
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user