vim-patch:8.1.1824: crash when correctly spelled word is very long (#10725)

Problem:    Crash when correctly spelled word is very long. (Ben Kraft)
Solution:   Check word length before copying. (closes vim/vim#4778)
5bcc5a1ff9
This commit is contained in:
Jan Edmund Lazo
2019-08-08 11:23:25 -04:00
committed by Daniel Hahler
parent e4bd31dbac
commit ce628e1187
2 changed files with 17 additions and 2 deletions

View File

@@ -1807,9 +1807,11 @@ void count_common_word(slang_T *lp, char_u *word, int len, int count)
char_u buf[MAXWLEN];
char_u *p;
if (len == -1)
if (len == -1) {
p = word;
else {
} else if (len >= MAXWLEN) {
return;
} else {
STRLCPY(buf, word, len + 1);
p = buf;
}