summaryrefslogtreecommitdiff
path: root/src/insexpand.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-07-07 19:59:49 +0100
committerBram Moolenaar <Bram@vim.org>2022-07-07 19:59:49 +0100
commitbaefde14550231f6468ac2ed2ed495bc381c0c92 (patch)
tree01fd492bca105a1b2a77366bacecfb83320641a9 /src/insexpand.c
parentcaea66442d86e7bbba3bf3dc202c3c0d549b9853 (diff)
downloadvim-git-baefde14550231f6468ac2ed2ed495bc381c0c92.tar.gz
patch 9.0.0046: reading past end of completion with duplicate matchv9.0.0046
Problem: Reading past end of completion with duplicate match. Solution: Check string length
Diffstat (limited to 'src/insexpand.c')
-rw-r--r--src/insexpand.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/insexpand.c b/src/insexpand.c
index 0ecb6560c..9c598a89f 100644
--- a/src/insexpand.c
+++ b/src/insexpand.c
@@ -786,7 +786,8 @@ ins_compl_add(
{
if (!match_at_original_text(match)
&& STRNCMP(match->cp_str, str, len) == 0
- && match->cp_str[len] == NUL)
+ && ((int)STRLEN(match->cp_str) <= len
+ || match->cp_str[len] == NUL))
return NOTDONE;
match = match->cp_next;
} while (match != NULL && !is_first_match(match));