]> granicus.if.org Git - vim/commitdiff
patch 8.0.0852: MS-Windows: possible crash when giving a message on startup v8.0.0852
authorBram Moolenaar <Bram@vim.org>
Thu, 3 Aug 2017 16:55:00 +0000 (18:55 +0200)
committerBram Moolenaar <Bram@vim.org>
Thu, 3 Aug 2017 16:55:00 +0000 (18:55 +0200)
Problem:    MS-Windows: possible crash when giving a message on startup.
Solution:   Initialize length. (Yasuhiro Matsumoto, closes #1931)

src/message.c
src/version.c

index 9a4a32f3e5893284468e948d4fb408801f23feb0..e548fc0c97c31a9b2951ea52185855354743ec45 100644 (file)
@@ -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;
        }
index a5a3d68a193492ebeffdaeeebb843c1013468670..a029dd51c48b2883df326687319f95759a0b08ba 100644 (file)
@@ -769,6 +769,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    852,
 /**/
     851,
 /**/