diff options
author | Bram Moolenaar <Bram@vim.org> | 2018-09-22 14:39:15 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2018-09-22 14:39:15 +0200 |
commit | 7ff8a3cfb6b029f9af1fdf3890e1320cafce5111 (patch) | |
tree | 59de0f693fdae20226b649198b85fb7a42e22316 /src/gui_w32.c | |
parent | 4841a7ccaed57f723016656e9683b587ac91f621 (diff) | |
download | vim-git-7ff8a3cfb6b029f9af1fdf3890e1320cafce5111.tar.gz |
patch 8.1.0427: MS-Windows GUI: using invalid encoded file namev8.1.0427
Problem: MS-Windows GUI: using invalid encoded file name.
Solution: Drop the file name and return NULL. (Ken Takata, closes #3467)
Diffstat (limited to 'src/gui_w32.c')
-rw-r--r-- | src/gui_w32.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/gui_w32.c b/src/gui_w32.c index 8574b63fa..35c1790b4 100644 --- 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 */ |