News for hackers. Stuff that matters.
Re:Strlcpy and Strlcat – Consistent, Safe, String Copy and C... by Someone on Tuesday April 25, 2023 @07:34PM (#35708097)
> The tiny performance hit is usually worth the safety and simplicity

It need not even be a performance hit. The compiler could recognize the idiom of code such as

  snprintf(buffer, bufLen, "%s%s%s", s, t, u);
and optimize it into (example possibly buggy; my C is rusty)

    b = buffer;
    e = b + bufLen:
    while((b < e) && (*b++ = *s++));
    while((b < e) && (*b++ = *t++));
    while((b < e) && (*b++ = *u++));
    *b = 0;

There are no comments on this comment yet.