This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug manual/6651] New: Various multi-byte character function examples have logic error


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]