1
0
forked from aniani/vim

patch 8.2.3219: :find searches non-existing directories

Problem:    :find searches non-existing directories.
Solution:   Check the path is not "..".  Update help. (Christian Brabandt,
            closes #8612, closes #8533)
This commit is contained in:
Christian Brabandt
2021-07-25 15:08:05 +02:00
committed by Bram Moolenaar
parent 8a4c812ede
commit 7a4ca32175
4 changed files with 39 additions and 0 deletions

View File

@@ -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);
}