Opened 20 months ago
Closed 20 months ago
#18347 closed bug (fixed)
strxfrm return value is wrong
Reported by: | bhaible | Owned by: | nobody |
---|---|---|---|
Priority: | normal | Milestone: | R1/beta5 |
Component: | System/POSIX | Version: | R1/beta4 |
Keywords: | Cc: | ||
Blocked By: | Blocking: | ||
Platform: | All |
Description
POSIX <https://pubs.opengroup.org/onlinepubs/9699919799/functions/strxfrm.html> specifies that the return value of the strxfrm() function is "the length of the transformed string (not including the terminating NUL character)."
The attached program, foo.c, should therefore print a list of bytes of which the last one, and only the last one, is a NUL byte.
But that is not what it does. How to reproduce:
$ gcc -Wall foo.c $ ./a.out result has 24 bytes. result[0] = 0x2C result[1] = 0x46 result[2] = 0x4E result[3] = 0x32 result[4] = 0x04 result[5] = 0x2C result[6] = 0x52 result[7] = 0x2C result[8] = 0x2E result[9] = 0x38 result[10] = 0x32 result[11] = 0x44 result[12] = 0x01 result[13] = 0x44 result[14] = 0x96 result[15] = 0x41 result[16] = 0x96 result[17] = 0x09 result[18] = 0x01 result[19] = 0xDC result[20] = 0xC1 result[21] = 0xDC result[22] = 0x0B result[23] = 0x00 result[24] = 0x02
You can see that the second-to-one printed byte is a NUL byte.
Attachments (1)
Change History (2)
by , 20 months ago
comment:1 by , 20 months ago
Milestone: | Unscheduled → R1/beta5 |
---|---|
Resolution: | → fixed |
Status: | new → closed |
Fixed in hrev56907.
Note:
See TracTickets
for help on using tickets.
test case