neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

commit b4c4c232ba6fe3df5c6f12faff4405a16e4d40df
parent 881d4adb5942301a26ccd45315e146eccb114519
Author: zeertzjq <zeertzjq@outlook.com>
Date:   Sat, 28 Jan 2023 13:06:45 +0800

fix(fileio.c): don't use uninitialized memory (#22031)


Diffstat:
Msrc/nvim/fileio.c | 8++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c @@ -5439,6 +5439,10 @@ bool match_file_list(char *list, char *sfname, char *ffname) char *file_pat_to_reg_pat(const char *pat, const char *pat_end, char *allow_dirs, int no_bslash) FUNC_ATTR_NONNULL_ARG(1) { + if (allow_dirs != NULL) { + *allow_dirs = false; + } + if (pat_end == NULL) { pat_end = pat + strlen(pat); } @@ -5447,10 +5451,6 @@ char *file_pat_to_reg_pat(const char *pat, const char *pat_end, char *allow_dirs return xstrdup("^$"); } - if (allow_dirs != NULL) { - *allow_dirs = false; - } - size_t size = 2; // '^' at start, '$' at end. for (const char *p = pat; p < pat_end; p++) {