diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-02-02 22:31:14 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-02 22:31:14 +0800 |
commit | 21cdecc8e0233d7a99d971327d21f701dbd65ba1 (patch) | |
tree | dadd0e388a991cc8f9c0c84fbc9ca60da7586d65 /src/nvim/file_search.c | |
parent | 0c66c7dafdb78471ab3050b608301aaacb137a6e (diff) | |
parent | 7d72076a6f3bd3cb85100c94bfeb7a70de345c3b (diff) | |
download | rneovim-21cdecc8e0233d7a99d971327d21f701dbd65ba1.tar.gz rneovim-21cdecc8e0233d7a99d971327d21f701dbd65ba1.tar.bz2 rneovim-21cdecc8e0233d7a99d971327d21f701dbd65ba1.zip |
Merge pull request #17245 from zeertzjq/vim-8.2.3219
vim-patch:8.2.3219: :find searches non-existing directories
Diffstat (limited to 'src/nvim/file_search.c')
-rw-r--r-- | src/nvim/file_search.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/nvim/file_search.c b/src/nvim/file_search.c index b4becb3066..25dbf680de 100644 --- a/src/nvim/file_search.c +++ b/src/nvim/file_search.c @@ -483,8 +483,14 @@ void *vim_findfile_init(char_u *path, char_u *filename, char_u *stopdirs, int le int len = 0; if (p > search_ctx->ffsc_fix_path) { + // do not add '..' to the path and start upwards searching len = (int)(p - search_ctx->ffsc_fix_path) - 1; - STRNCAT(ff_expand_buffer, search_ctx->ffsc_fix_path, len); + if ((len >= 2 && STRNCMP(search_ctx->ffsc_fix_path, "..", 2) == 0) + && (len == 2 || search_ctx->ffsc_fix_path[2] == PATHSEP)) { + xfree(buf); + goto error_return; + } + STRLCAT(ff_expand_buffer, search_ctx->ffsc_fix_path, eb_len + (size_t)len + 1); add_pathsep((char *)ff_expand_buffer); } else { len = (int)STRLEN(search_ctx->ffsc_fix_path); |