Mercurial > vim
comparison src/findfile.c @ 25364:af5c4fabcf40 v8.2.3219
patch 8.2.3219: :find searches non-existing directories
Commit: https://github.com/vim/vim/commit/7a4ca32175bef0f9a177052796bd9addd10dc218
Author: Christian Brabandt <cb@256bit.org>
Date: Sun Jul 25 15:08:05 2021 +0200
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)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 25 Jul 2021 15:15:04 +0200 |
parents | 5f8dd7b3ae41 |
children | e8e2c4d33b9b |
comparison
equal
deleted
inserted
replaced
25363:3ec88da38ae2 | 25364:af5c4fabcf40 |
---|---|
576 char_u *temp = NULL; | 576 char_u *temp = NULL; |
577 int len = 0; | 577 int len = 0; |
578 | 578 |
579 if (p > search_ctx->ffsc_fix_path) | 579 if (p > search_ctx->ffsc_fix_path) |
580 { | 580 { |
581 // do not add '..' to the path and start upwards searching | |
581 len = (int)(p - search_ctx->ffsc_fix_path) - 1; | 582 len = (int)(p - search_ctx->ffsc_fix_path) - 1; |
583 if ((len >= 2 | |
584 && STRNCMP(search_ctx->ffsc_fix_path, "..", 2) == 0) | |
585 && (len == 2 | |
586 || search_ctx->ffsc_fix_path[2] == PATHSEP)) | |
587 { | |
588 vim_free(buf); | |
589 goto error_return; | |
590 } | |
582 STRNCAT(ff_expand_buffer, search_ctx->ffsc_fix_path, len); | 591 STRNCAT(ff_expand_buffer, search_ctx->ffsc_fix_path, len); |
583 add_pathsep(ff_expand_buffer); | 592 add_pathsep(ff_expand_buffer); |
584 } | 593 } |
585 else | 594 else |
586 len = (int)STRLEN(search_ctx->ffsc_fix_path); | 595 len = (int)STRLEN(search_ctx->ffsc_fix_path); |