changeset 14830:9d9e4a929357 v8.1.0427

patch 8.1.0427: MS-Windows GUI: using invalid encoded file name commit https://github.com/vim/vim/commit/7ff8a3cfb6b029f9af1fdf3890e1320cafce5111 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Sep 22 14:39:15 2018 +0200 patch 8.1.0427: MS-Windows GUI: using invalid encoded file name Problem: MS-Windows GUI: using invalid encoded file name. Solution: Drop the file name and return NULL. (Ken Takata, closes https://github.com/vim/vim/issues/3467)
author Christian Brabandt <cb@256bit.org>
date Sat, 22 Sep 2018 14:45:05 +0200
parents 550ac2202b84
children 5924ca71fb3e
files src/gui_w32.c src/version.c
diffstat 2 files changed, 8 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/gui_w32.c
+++ b/src/gui_w32.c
@@ -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 */
 
--- a/src/version.c
+++ b/src/version.c
@@ -795,6 +795,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    427,
+/**/
     426,
 /**/
     425,