[PATCH v7] Implement strlcpy, strlcat [BZ #178]

Paul Eggert eggert@cs.ucla.edu
Tue Jan 5 21:06:00 GMT 2016


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.



More information about the Libc-alpha mailing list