]> granicus.if.org Git - vim/commitdiff
patch 8.1.0427: MS-Windows GUI: using invalid encoded file name v8.1.0427
authorBram Moolenaar <Bram@vim.org>
Sat, 22 Sep 2018 12:39:15 +0000 (14:39 +0200)
committerBram Moolenaar <Bram@vim.org>
Sat, 22 Sep 2018 12:39:15 +0000 (14:39 +0200)
Problem:    MS-Windows GUI: using invalid encoded file name.
Solution:   Drop the file name and return NULL. (Ken Takata, closes #3467)

src/gui_w32.c
src/version.c

index 8574b63facc1725747884bbfd8fcc33091179b48..35c1790b49e51718706745d264ca36e75833def0 100644 (file)
@@ -3627,7 +3627,7 @@ gui_mch_browseW(
     WCHAR              *extp = NULL;
     WCHAR              *initdirp = NULL;
     WCHAR              *filterp;
-    char_u             *p;
+    char_u             *p, *q;
 
     if (dflt == NULL)
        fileBuf[0] = NUL;
@@ -3713,16 +3713,16 @@ gui_mch_browseW(
 
     /* Convert from UCS2 to 'encoding'. */
     p = utf16_to_enc(fileBuf, NULL);
-    if (p != NULL)
-       /* when out of memory we get garbage for non-ASCII chars */
-       STRCPY(fileBuf, p);
-    vim_free(p);
+    if (p == NULL)
+       return NULL;
 
     /* Give focus back to main window (when using MDI). */
     SetFocus(s_hwnd);
 
     /* Shorten the file name if possible */
-    return vim_strsave(shorten_fname1((char_u *)fileBuf));
+    q = vim_strsave(shorten_fname1(p));
+    vim_free(p);
+    return q;
 }
 # endif /* FEAT_MBYTE */
 
index 480c1abf6916b177df6280f01838d5485939b14c..88163a20e0599cb2f095cfd2a1cf3ca60dec9757 100644 (file)
@@ -794,6 +794,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    427,
 /**/
     426,
 /**/