aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/path.c
diff options
context:
space:
mode:
authorbfredl <bjorn.linse@gmail.com>2023-04-17 13:08:53 +0200
committerbfredl <bjorn.linse@gmail.com>2023-04-19 16:34:15 +0200
commitaee6f08ce12a62e9104892702a658a8d3daee4df (patch)
tree3a9e9b6f0e546fe3f685a1de2a074118ed19c860 /src/nvim/path.c
parent7bf1a917b78ebc622b6691af9196b95b4a9d3142 (diff)
downloadrneovim-aee6f08ce12a62e9104892702a658a8d3daee4df.tar.gz
rneovim-aee6f08ce12a62e9104892702a658a8d3daee4df.tar.bz2
rneovim-aee6f08ce12a62e9104892702a658a8d3daee4df.zip
fix(runtime): do not allow breakcheck inside runtime path calculation
problem: breakcheck might run arbitrary lua code, which might require modules and thus invoke runtime path calculation recursively. solution: Block the use of breakcheck when expanding glob patterns inside 'runtimepath' fixes #23012
Diffstat (limited to 'src/nvim/path.c')
-rw-r--r--src/nvim/path.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/nvim/path.c b/src/nvim/path.c
index cf7cd98829..21a3a67e24 100644
--- a/src/nvim/path.c
+++ b/src/nvim/path.c
@@ -620,7 +620,7 @@ static size_t do_path_expand(garray_T *gap, const char *path, size_t wildoff, in
static int stardepth = 0; // depth for "**" expansion
// Expanding "**" may take a long time, check for CTRL-C.
- if (stardepth > 0) {
+ if (stardepth > 0 && !(flags & EW_NOBREAK)) {
os_breakcheck();
if (got_int) {
return 0;
@@ -701,7 +701,8 @@ static size_t do_path_expand(garray_T *gap, const char *path, size_t wildoff, in
if (flags & (EW_NOERROR | EW_NOTWILD)) {
emsg_silent++;
}
- regmatch.regprog = vim_regcomp(pat, RE_MAGIC);
+ bool nobreak = (flags & EW_NOBREAK);
+ regmatch.regprog = vim_regcomp(pat, RE_MAGIC | (nobreak ? RE_NOBREAK : 0));
if (flags & (EW_NOERROR | EW_NOTWILD)) {
emsg_silent--;
}