1
0
mirror of git://git.sv.gnu.org/coreutils.git synced 2026-08-04 15:49:42 +02:00

(mbsnwidth): Don't loop endlessly when called with an

invalid mulitbyte sequence and with the MBSW_ACCEPT_INVALID flag set.
This commit is contained in:
Jim Meyering
2000-12-08 18:31:38 +00:00
parent a90e5f5a69
commit a05267197a
+10 -2
View File
@@ -153,7 +153,11 @@ mbsnwidth (const char *string, size_t nbytes, int flags)
/* An invalid multibyte sequence was encountered. */
{
if (flags & MBSW_ACCEPT_INVALID)
break;
{
p++;
width++;
break;
}
else
return -1;
}
@@ -162,7 +166,11 @@ mbsnwidth (const char *string, size_t nbytes, int flags)
/* An incomplete multibyte character at the end. */
{
if (flags & MBSW_ACCEPT_INVALID)
break;
{
p = plimit;
width++;
break;
}
else
return -1;
}