Mercurial > vim
diff src/findfile.c @ 26159:34606aec52b3 v8.2.3611
patch 8.2.3611: crash when using CTRL-W f without finding a file name
Commit: https://github.com/vim/vim/commit/615ddd5342b50a6878a907062aa471740bd9a847
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Nov 17 18:00:31 2021 +0000
patch 8.2.3611: crash when using CTRL-W f without finding a file name
Problem: Crash when using CTRL-W f without finding a file name.
Solution: Bail out when the file name length is zero.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 17 Nov 2021 19:15:03 +0100 |
parents | e8e2c4d33b9b |
children | 97b7db88e094 |
line wrap: on
line diff
--- a/src/findfile.c +++ b/src/findfile.c @@ -1735,6 +1735,9 @@ find_file_in_path_option( proc->pr_WindowPtr = (APTR)-1L; # endif + if (len == 0) + return NULL; + if (first == TRUE) { // copy file name into NameBuff, expanding environment variables @@ -2118,7 +2121,12 @@ find_file_name_in_path( int c; # if defined(FEAT_FIND_ID) && defined(FEAT_EVAL) char_u *tofree = NULL; +# endif + if (len == 0) + return NULL; + +# if defined(FEAT_FIND_ID) && defined(FEAT_EVAL) if ((options & FNAME_INCL) && *curbuf->b_p_inex != NUL) { tofree = eval_includeexpr(ptr, len);