This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug manual/6651] New: Various multi-byte character function examples have logic error
- From: "kenny at the-b dot org" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sources dot redhat dot com
- Date: 17 Jun 2008 19:49:06 -0000
- Subject: [Bug manual/6651] New: Various multi-byte character function examples have logic error
- Reply-to: sourceware-bugzilla at sourceware dot org
The functions mbrtowc and mbrlen have code fragments in their usage examples:
while ((nbytes = mbrtowc (tmp, s, len, &state)) > 0)
{
if (nbytes >= (size_t) -2)
/* Invalid input string. */
return NULL;
....
}
If the nbytes variable were greater than 0 coming into the while loop, it would
be caught by the if statement and return a NULL for all cases.
--
Summary: Various multi-byte character function examples have
logic error
Product: glibc
Version: unspecified
Status: NEW
Severity: minor
Priority: P3
Component: manual
AssignedTo: roland at gnu dot org
ReportedBy: kenny at the-b dot org
CC: glibc-bugs at sources dot redhat dot com
http://sourceware.org/bugzilla/show_bug.cgi?id=6651
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.