<div dir="ltr">Unless buffer is a char* instead of a char[] in which case its completely wrong.   A very common case among buggy C code.<div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Nov 27, 2019 at 7:09 AM Phillip Susi <<a href="mailto:phill@thesusis.net">phill@thesusis.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
Michael Wojcik writes:<br>
<br>
> Some C experts have argued that the length-checking versions of the library functions, either the C90 ones such as strncat or the Appendix K ones, are essentially pointless anyway; that the caller needs to handle truncation and so ought to know whether truncation (or overflow) would occur before attempting the operation.<br>
<br>
Isn't this normally/easilly handled simply by passing sizeof( buffer ) -<br>
1?  Then the last byte is always \0 whether or not the copy was truncated.<br>
</blockquote></div>