summaryrefslogtreecommitdiff
path: root/src/spell.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2010-08-01 15:11:43 +0200
committerBram Moolenaar <Bram@vim.org>2010-08-01 15:11:43 +0200
commit121d95f7d181a65807c787039147e8f7d76e5a87 (patch)
treee1b2e296e96ef66d6c52279b5c75c9e16b93a93d /src/spell.c
parent3b0dd7cd35e4eab0b953cfdab87030f06eb073ed (diff)
downloadvim-git-121d95f7d181a65807c787039147e8f7d76e5a87.tar.gz
Fix: uninitialized memory access. (Dominique Pelle)
Diffstat (limited to 'src/spell.c')
-rw-r--r--src/spell.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/spell.c b/src/spell.c
index 30510ad27..eb04c2910 100644
--- a/src/spell.c
+++ b/src/spell.c
@@ -14751,10 +14751,18 @@ soundalike_score(goodstart, badstart)
char_u *pl2, *ps2;
int score = 0;
- /* adding/inserting "*" at the start (word starts with vowel) shouldn't be
+ /* Adding/inserting "*" at the start (word starts with vowel) shouldn't be
* counted so much, vowels halfway the word aren't counted at all. */
if ((*badsound == '*' || *goodsound == '*') && *badsound != *goodsound)
{
+ if ((badsound[0] == NUL && goodsound[1] == NUL)
+ || (goodsound[0] == NUL && badsound[1] == NUL))
+ /* changing word with vowel to word without a sound */
+ return SCORE_DEL;
+ if (badsound[0] == NUL || goodsound[0] == NUL)
+ /* more than two changes */
+ return SCORE_MAXMAX;
+
if (badsound[1] == goodsound[1]
|| (badsound[1] != NUL
&& goodsound[1] != NUL