aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/spell.c
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2019-08-08 11:23:25 -0400
committerDaniel Hahler <git@thequod.de>2019-08-08 17:23:25 +0200
commitce628e11877f426851d68ff1215c1cc25d9b5292 (patch)
tree54797f9f4fa3ad8733fbf3aee870d7934b8ec8e4 /src/nvim/spell.c
parente4bd31dbaceefd21932b96f11e7f555d607ffd49 (diff)
downloadrneovim-ce628e11877f426851d68ff1215c1cc25d9b5292.tar.gz
rneovim-ce628e11877f426851d68ff1215c1cc25d9b5292.tar.bz2
rneovim-ce628e11877f426851d68ff1215c1cc25d9b5292.zip
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) https://github.com/vim/vim/commit/5bcc5a1ff94bbab1b175e35a72e3df974106b393
Diffstat (limited to 'src/nvim/spell.c')
-rw-r--r--src/nvim/spell.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/nvim/spell.c b/src/nvim/spell.c
index cc214616f4..404f279e73 100644
--- a/src/nvim/spell.c
+++ b/src/nvim/spell.c
@@ -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;
}