This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [review] manual: Clarify strnlen, wcsnlen, strndup null termination behavior
On Wed, 30 Oct 2019, Zack Weinberg wrote:
> I agree with Florian's interpretation. The text Andreas quoted only says
> that strnlen shall find the first null byte within the array and
> return the number of bytes preceding. It does not say anything about
> whether read accesses beyond the first NUL are allowed.
Also, ISO C has special wording for memchr for this issue "The
implementation shall behave as if it reads the characters sequentially and
stops as soon as a matching character is found.", which it doesn't for
other string functions. (As noted in the prior discussion of strnlen in
bug 19391, currently marked RESOLVED/INVALID.)
--
Joseph S. Myers
joseph@codesourcery.com
- References:
- [review] manual: Clarify strnlen, wcsnlen, strndup null termination behavior
- From: Florian Weimer (Code Review)
- Re: [review] manual: Clarify strnlen, wcsnlen, strndup null termination behavior
- Re: [review] manual: Clarify strnlen, wcsnlen, strndup null termination behavior
- Re: [review] manual: Clarify strnlen, wcsnlen, strndup null termination behavior
- Re: [review] manual: Clarify strnlen, wcsnlen, strndup null termination behavior
- Re: [review] manual: Clarify strnlen, wcsnlen, strndup null termination behavior
- Re: [review] manual: Clarify strnlen, wcsnlen, strndup null termination behavior