Mercurial > vim
comparison 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 |
comparison
equal
deleted
inserted
replaced
26158:9b1f90bc52dc | 26159:34606aec52b3 |
---|---|
1733 | 1733 |
1734 // Avoid a requester here for a volume that doesn't exist. | 1734 // Avoid a requester here for a volume that doesn't exist. |
1735 proc->pr_WindowPtr = (APTR)-1L; | 1735 proc->pr_WindowPtr = (APTR)-1L; |
1736 # endif | 1736 # endif |
1737 | 1737 |
1738 if (len == 0) | |
1739 return NULL; | |
1740 | |
1738 if (first == TRUE) | 1741 if (first == TRUE) |
1739 { | 1742 { |
1740 // copy file name into NameBuff, expanding environment variables | 1743 // copy file name into NameBuff, expanding environment variables |
1741 save_char = ptr[len]; | 1744 save_char = ptr[len]; |
1742 ptr[len] = NUL; | 1745 ptr[len] = NUL; |
2116 { | 2119 { |
2117 char_u *file_name; | 2120 char_u *file_name; |
2118 int c; | 2121 int c; |
2119 # if defined(FEAT_FIND_ID) && defined(FEAT_EVAL) | 2122 # if defined(FEAT_FIND_ID) && defined(FEAT_EVAL) |
2120 char_u *tofree = NULL; | 2123 char_u *tofree = NULL; |
2121 | 2124 # endif |
2125 | |
2126 if (len == 0) | |
2127 return NULL; | |
2128 | |
2129 # if defined(FEAT_FIND_ID) && defined(FEAT_EVAL) | |
2122 if ((options & FNAME_INCL) && *curbuf->b_p_inex != NUL) | 2130 if ((options & FNAME_INCL) && *curbuf->b_p_inex != NUL) |
2123 { | 2131 { |
2124 tofree = eval_includeexpr(ptr, len); | 2132 tofree = eval_includeexpr(ptr, len); |
2125 if (tofree != NULL) | 2133 if (tofree != NULL) |
2126 { | 2134 { |