}
else
{
- if (n+nmore > length)
- nmore = length - n; /* Oops, encoding to short */
-
tmp[0] = *s++; n++;
- for (i=1; i <= nmore; i++)
+ for (i=1; n < length && i <= nmore; i++)
{
if ( (*s & 0xc0) != 0x80)
break; /* Invalid encoding - let the next cycle detect this. */