[PATCH] Implement strlcat [BZ#178]

Paul Eggert eggert@cs.ucla.edu
Thu Dec 3 17:56:00 GMT 2015


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.



More information about the Libc-alpha mailing list