News for hackers. Stuff that matters.
Re:Strlcpy and Strlcat – Consistent, Safe, String Copy and C... by krylon on Tuesday April 25, 2023 @10:51AM (#35701293)
As a bonus, if you pass NULL for the first argument, its return value tells you how much memory it would have used, so you can allocate a buffer that's the right size. Bigger performance hit, but in practice, I found the impact negligible in a codebase that doesn't do a lot of stringy stuff but needs to emit reasonable messages to logfiles etc.

There are no comments on this comment yet.