# HG changeset patch # User Bram Moolenaar # Date 1385052151 -3600 # Node ID 9417f4de27a2a6acfa6b1660ac6ef2b5692e4554 # Parent 1a5dafa45c8274a78f70f9f5fe76a9a96bd11180 updated for version 7.4.102 Problem: Crash when interrupting "z=". Solution: Add safety check for word length. (Christian Brabandt, Dominique Pelle) diff --git a/src/spell.c b/src/spell.c --- a/src/spell.c +++ b/src/spell.c @@ -13398,9 +13398,8 @@ add_sound_suggest(su, goodword, score, l /* Lookup the word "orgnr" one of the two tries. */ n = 0; - wlen = 0; wordcount = 0; - for (;;) + for (wlen = 0; wlen < MAXWLEN - 3; ++wlen) { i = 1; if (wordcount == orgnr && byts[n + 1] == NUL) @@ -13414,6 +13413,7 @@ add_sound_suggest(su, goodword, score, l if (i > byts[n]) /* safety check */ { STRCPY(theword + wlen, "BAD"); + wlen += 3; goto badword; } @@ -13426,7 +13426,7 @@ add_sound_suggest(su, goodword, score, l wordcount += wc; } - theword[wlen++] = byts[n + i]; + theword[wlen] = byts[n + i]; n = idxs[n + i]; } badword: diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -739,6 +739,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 102, +/**/ 101, /**/ 100,