This is the mail archive of the
mailing list for the glibc project.
Re: [PATCH] Implement strlcat [BZ#178]
- From: Paul Eggert <eggert at cs dot ucla dot edu>
- To: Zack Weinberg <zackw at panix dot com>
- Cc: Florian Weimer <fweimer at redhat dot com>, GNU C Library <libc-alpha at sourceware dot org>
- Date: Thu, 3 Dec 2015 09:56:46 -0800
- 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>
On 12/03/2015 09:36 AM, Zack Weinberg wrote:
I would not at all be surprised to find code deliberately calling
strlcpy with destination size zero in order to learn how big the
destination buffer needed to be.
Calling strlcpy (DST, SRC, 0) instead of the more-obvious strlen (SRC)?
Really? That would be bizarre. I'd like to see an example.
Also, would you be surprised by a call strlcpy (NULL, SRC, 0) instead of
the more-obvious strlen (SRC)? Florian's proposed wording (like my
proposal) would prohibit such a call. Even though strlcpy (NULL, SRC,
0) works just fine on BSD and the OpenBSD and FreeBSD man pages don't
prohibit it, surely glibc doesn't need to support this usage, and surely
the same is true for strlcpy (DST, SRC, 0) when DST is non-NULL.