diff options
author | Christian Brabandt <cb@256bit.org> | 2021-07-25 15:08:05 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-07-25 15:08:05 +0200 |
commit | 7a4ca32175bef0f9a177052796bd9addd10dc218 (patch) | |
tree | a97843cf615b86a4ad7dd221746cb5454df24a2f /src/findfile.c | |
parent | 8a4c812ede5b01a8e71082c1ff4ebfcbf1bd515f (diff) | |
download | vim-git-7a4ca32175bef0f9a177052796bd9addd10dc218.tar.gz |
patch 8.2.3219: :find searches non-existing directoriesv8.2.3219
Problem: :find searches non-existing directories.
Solution: Check the path is not "..". Update help. (Christian Brabandt,
closes #8612, closes #8533)
Diffstat (limited to 'src/findfile.c')
-rw-r--r-- | src/findfile.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/findfile.c b/src/findfile.c index a72fe45ad..7c2a61f4a 100644 --- a/src/findfile.c +++ b/src/findfile.c @@ -578,7 +578,16 @@ vim_findfile_init( 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; + if ((len >= 2 + && STRNCMP(search_ctx->ffsc_fix_path, "..", 2) == 0) + && (len == 2 + || search_ctx->ffsc_fix_path[2] == PATHSEP)) + { + vim_free(buf); + goto error_return; + } STRNCAT(ff_expand_buffer, search_ctx->ffsc_fix_path, len); add_pathsep(ff_expand_buffer); } |