summaryrefslogtreecommitdiff
path: root/strings
diff options
context:
space:
mode:
Diffstat (limited to 'strings')
-rw-r--r--strings/ctype-big5.c2
-rw-r--r--strings/ctype-ucs2.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/strings/ctype-big5.c b/strings/ctype-big5.c
index e12ff189eaf..447eea3e635 100644
--- a/strings/ctype-big5.c
+++ b/strings/ctype-big5.c
@@ -6301,7 +6301,7 @@ uint my_well_formed_len_big5(CHARSET_INFO *cs __attribute__((unused)),
const char *emb= e - 1; /* Last possible end of an MB character */
*error= 0;
- while (pos && b < e)
+ while (pos-- && b < e)
{
if ((uchar) b[0] < 128)
{
diff --git a/strings/ctype-ucs2.c b/strings/ctype-ucs2.c
index d15144b7438..e57ad8e7d69 100644
--- a/strings/ctype-ucs2.c
+++ b/strings/ctype-ucs2.c
@@ -1267,7 +1267,7 @@ uint my_charpos_ucs2(CHARSET_INFO *cs __attribute__((unused)),
const char *e __attribute__((unused)),
uint pos)
{
- return pos*2;
+ return pos > e - b ? e - b + 2 : pos * 2;
}