clarifcation on interfaces like strnlen

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In today's Austin Group meeting (the group behind POSIX), it was noted
that there is a potential discrepancy between C2Y and POSIX regarding
whether strnlen(3) operates on "strings" (the C standard defines this
as a NUL-terminated sequence) vs. length-limited arrays of characters
(which may or may not contain a NUL byte within the bounds given).

https://www.austingroupbugs.net/view.php?id=1834

One of the contributors to the C standard (Chris Bazeley) then replied
that his proposal for strnlen to C2Y was based in part on the existing
wording of https://man7.org/linux/man-pages/man3/strnlen.3.html, where
the man pages were not as precise as the POSIX Issue 8 wording, as
well as the fact that C is already inconsistent in its wording for
strnlen_s; although he also expressed an openness to revising his
draft based on consensus.

It may be worth some preliminary cleanup patches to the Linux man
pages for strnlen and friends to follow the example of POSIX in
distinguishing when an argument is a string (must have NUL terminator)
vs a length-bounded array of bytes (which may or may not include a NUL
terminator), to make it easier for everyone to share common wording
when C2Y eventually adds the function.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.
Virtualization:  qemu.org | libguestfs.org





[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux