This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH v7] Implement strlcpy, strlcat [BZ #178]
- From: Paul Eggert <eggert at cs dot ucla dot edu>
- To: Alexander Cherepanov <ch3root at openwall dot com>, Florian Weimer <fweimer at redhat dot com>
- Cc: GNU C Library <libc-alpha at sourceware dot org>
- Date: Tue, 5 Jan 2016 13:05:58 -0800
- Subject: Re: [PATCH v7] Implement strlcpy, strlcat [BZ #178]
- Authentication-results: sourceware.org; auth=none
- References: <5682DD7E dot 6000301 at redhat dot com> <56839678 dot 8040304 at cs dot ucla dot edu> <568ADC5F dot 5010608 at redhat dot com> <568B0824 dot 6000101 at openwall dot com> <568B13CE dot 3060507 at cs dot ucla dot edu> <568B2A04 dot 9050904 at openwall dot com> <568B6B91 dot 5080904 at cs dot ucla dot edu> <568C1628 dot 9020507 at openwall dot com>
On 01/05/2016 11:14 AM, Alexander Cherepanov wrote:
Your first reading of POSIX seems quite reasonable to me. And that
reading conflicts with C11 so I reported it in
http://austingroupbugs.net/view.php?id=1020 .
I was referring to the C11 semantics, which POSIX defers to. In looking
at that bug-report trail, it appears that the semantics of snprintf are
controversial in this area. And rightly so, since C11 requires
implementations to not diagnose troublesome application usage such as
snprintf (buf, SIZE_MAX, ...).
But now that we are agree to ignore POSIX for a moment, this detail is
not important.
True.
it boils down to the question which sources are considers
authoritative for describing strlcpy/strlcat?
There aren't any. The BSD man pages do not agree, and their
implementations do not agree. If we add strlcpy/strlcat, we will just
need to use our best judgment to distinguish valid from buggy uses.