diff options
author | Bram Moolenaar <Bram@vim.org> | 2010-10-27 13:37:44 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2010-10-27 13:37:44 +0200 |
commit | c395a3aac26875fd494a98b0a2221a414d9076d7 (patch) | |
tree | eaea6f4a0168e811ece59080894633f0fe6d974f /src/mbyte.c | |
parent | fc3c83e47e22ae510fa5ade38e872ad6d8a21a0a (diff) | |
download | vim-git-c395a3aac26875fd494a98b0a2221a414d9076d7.tar.gz |
updated for version 7.3.040v7.3.040
Problem: Comparing strings while ignoring case goes beyond end of the
string when there are illegal bytes. (Dominique Pelle)
Solution: Explicitly check for illegal bytes.
Diffstat (limited to 'src/mbyte.c')
-rw-r--r-- | src/mbyte.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/mbyte.c b/src/mbyte.c index 9c0b18791..61a7d8bd6 100644 --- a/src/mbyte.c +++ b/src/mbyte.c @@ -3124,6 +3124,9 @@ mb_strnicmp(s1, s2, nn) /* If one of the two characters is incomplete return -1. */ if (incomplete || i + utf_byte2len(s2[i]) > n) return -1; + /* Don't case-fold illegal bytes or truncated characters. */ + if (utf_ptr2len(s1 + i) < l || utf_ptr2len(s2 + i) < l) + return -1; cdiff = utf_fold(utf_ptr2char(s1 + i)) - utf_fold(utf_ptr2char(s2 + i)); if (cdiff != 0) |