updated for version 7.0081
diff --git a/src/mbyte.c b/src/mbyte.c
index 996eb8d..93375bc 100644
--- a/src/mbyte.c
+++ b/src/mbyte.c
@@ -2192,6 +2192,7 @@
{
int i, j, l;
int cdiff;
+ int incomplete = FALSE;
int n = nn;
for (i = 0; i < n; i += l)
@@ -2202,7 +2203,10 @@
{
l = utf_byte2len(s1[i]);
if (l > n - i)
+ {
l = n - i; /* incomplete character */
+ incomplete = TRUE;
+ }
/* Check directly first, it's faster. */
for (j = 0; j < l; ++j)
if (s1[i + j] != s2[i + j])
@@ -2210,7 +2214,7 @@
if (j < l)
{
/* If one of the two characters is incomplete return -1. */
- if (i + utf_byte2len(s1[i]) > n || i + utf_byte2len(s2[i]) > n)
+ if (incomplete || i + utf_byte2len(s2[i]) > n)
return -1;
cdiff = utf_fold(utf_ptr2char(s1 + i))
- utf_fold(utf_ptr2char(s2 + i));