vim-patch:9.0.0046: reading past end of completion with duplicate match

Problem:    Reading past end of completion with duplicate match.
Solution:   Check string length
baefde1455
This commit is contained in:
zeertzjq
2022-08-24 21:40:14 +08:00
parent c366a63e4c
commit 5d1f0c3eca
2 changed files with 11 additions and 1 deletions

View File

@@ -709,7 +709,7 @@ static int ins_compl_add(char_u *const str, int len, char_u *const fname,
do {
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)) {
FREE_CPTEXT(cptext, cptext_allocated);
return NOTDONE;
}