This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Implement strlcat [BZ#178]
- From: Florian Weimer <fweimer at redhat dot com>
- To: Paul Eggert <eggert at cs dot ucla dot edu>, libc-alpha at sourceware dot org
- Cc: Zack Weinberg <zackw at panix dot com>
- Date: Thu, 10 Dec 2015 17:44:21 +0100
- Subject: Re: [PATCH] Implement strlcat [BZ#178]
- Authentication-results: sourceware.org; auth=none
- References: <56547472 dot 3010302 at redhat dot com> <5654B1FE dot 5020100 at cs dot ucla dot edu> <5654B796 dot 7070302 at redhat dot com> <5656E018 dot 5020608 at cs dot ucla dot edu> <565F211A dot 2030909 at redhat dot com> <56607CD1 dot 3050209 at cs dot ucla dot edu> <CAKCAbMgDMK9wjfNEJYW7e-cN9s5aVhun6V08OXrcOgYKRYF7_g at mail dot gmail dot com> <5660825E dot 9020901 at cs dot ucla dot edu> <CAKCAbMi2zSJRjS=ceg8UvTYY18UrCWysaOFX+OzvKZQfeR9+SA at mail dot gmail dot com> <5660C545 dot 1090805 at cs dot ucla dot edu> <56617536 dot 9040308 at redhat dot com> <5661BA22 dot 8060108 at cs dot ucla dot edu>
On 12/04/2015 05:06 PM, Paul Eggert wrote:
> On 12/04/2015 03:12 AM, Florian Weimer wrote:
>>> There is no "_exactly_". The BSDs differ.
>> I think the behavior is the same.
>
> No, as I mentioned elsewhere, the NetBSD iimplementation does not allow
> strlcpy(0, SRC, 0) whereas the FreeBSD implementation does (and this
> disagrees with the FreeBSD documentation where it says the destination
> must be a string).
Hmm. I looked at this, and everything points towards the NetBSD
implementation being buggy in this regard. Destination-NULL-size-0 is
supported by snprintf, so it should be supported by strlcpy as well (and
strlcat, by analogy). I will update my patch accordingly.
The question what to do if the terminator is not found in the
destination buffer (for strlcat) is still open.
Florian