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, Oct 30, 2019 at 12:47 PM Andreas Schwab <schwab@suse.de> wrote:
> On Okt 30 2019, Zack Weinberg wrote:
> > On Wed, Oct 30, 2019 at 12:20 PM Andreas Schwab <schwab@suse.de> wrote:
> >> On Okt 30 2019, Zack Weinberg wrote:
> >>
> >> > It says that accesses beyond maxlen are forbidden, but it *doesn't*
> >> > say that accesses beyond the first NUL are forbidden; therefore they
> >> > are allowed.
> >>
> >> Neither does it say that about strncpy or strncat.
> >
> > I don't see why that would change anything.
>
> That means that strncpy (x, "a", 10) is undefined.
Yes, that could be a defect in the specification of strncpy (I can
argue either way about what the parenthetical "(bytes that follow a
NUL character are not copied)" means). How does text's presence or
absence in the specification of strncpy change anything about the
requirements on strnlen?
zw
- 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
- 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