aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/spell.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-05-23 19:17:09 +0800
committerzeertzjq <zeertzjq@outlook.com>2022-06-27 05:33:54 +0800
commit80af2c6055cbc393ee73a8a38cef1e498aaae41d (patch)
tree9a55d17c97181dcd1f42d1aa92a9c80ae6ea4344 /src/nvim/spell.c
parentbafb53604a5b03fdc319f49d5c45f71df16038c1 (diff)
downloadrneovim-80af2c6055cbc393ee73a8a38cef1e498aaae41d.tar.gz
rneovim-80af2c6055cbc393ee73a8a38cef1e498aaae41d.tar.bz2
rneovim-80af2c6055cbc393ee73a8a38cef1e498aaae41d.zip
vim-patch:8.2.5007: spell suggestion may use uninitialized memory
Problem: Spell suggestion may use uninitialized memory. (Zdenek Dohnal) Solution: Avoid going over the end of the word. https://github.com/vim/vim/commit/6d24b4ff69913270ce1e5267dd6bd8454f75e2b9
Diffstat (limited to 'src/nvim/spell.c')
-rw-r--r--src/nvim/spell.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/nvim/spell.c b/src/nvim/spell.c
index f5b5fe9675..e597877a52 100644
--- a/src/nvim/spell.c
+++ b/src/nvim/spell.c
@@ -4381,7 +4381,9 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char_u *fword, bool so
#endif
++depth;
sp = &stack[depth];
- ++sp->ts_fidx;
+ if (fword[sp->ts_fidx] != NUL) {
+ sp->ts_fidx++;
+ }
tword[sp->ts_twordlen++] = c;
sp->ts_arridx = idxs[arridx];
if (newscore == SCORE_SUBST) {