changeset 5506:9417f4de27a2 v7.4.102

updated for version 7.4.102 Problem: Crash when interrupting "z=". Solution: Add safety check for word length. (Christian Brabandt, Dominique Pelle)
author Bram Moolenaar <bram@vim.org>
date Thu, 21 Nov 2013 17:42:31 +0100
parents 1a5dafa45c82
children 09f476198471
files src/spell.c src/version.c
diffstat 2 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- 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:
--- 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,