From a7187c17b7b44b276242e1122f675ee3c159245f Mon Sep 17 00:00:00 2001 From: James Tirta Halim Date: Sat, 8 Jun 2024 10:42:02 +0700 Subject: [PATCH] fixup: correct pat_e --- src/nvim/cmdexpand.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/nvim/cmdexpand.c b/src/nvim/cmdexpand.c index e8783b25ba..6aae3449be 100644 --- a/src/nvim/cmdexpand.c +++ b/src/nvim/cmdexpand.c @@ -2462,9 +2462,10 @@ static int expand_files_and_dirs(expand_T *xp, char *pat, char ***matches, int * // for ":set path=" and ":set tags=" halve backslashes for escaped space if (xp->xp_backslash != XP_BS_NONE) { - char *pat_e = pat + strlen(pat); + size_t pat_len = strlen(pat); free_pat = true; - pat = xmemdupz(pat, (size_t)(pat_e - pat)); + pat = xmemdupz(pat, pat_len); + char *pat_e = pat + pat_len; for (int i = 0; pat[i]; i++) { if (pat[i] == '\\') { if (xp->xp_backslash & XP_BS_THREE