>>16The problem with strlcpy and friends is they silently truncate the destination string to fit in the provided length. There are many cases where this behavior is not acceptable, and it is often quite trivial to avoid the possibility altogether. In your example, if the caller controls the allocation of
buffer
there should be no cause to use strlcpy at all - it can just check the length of the source literal first, and allocate a buffer of sufficient size.
strlcpy is a lot like strncpy in the sense that its name encourages programmers to use it in contexts where it is unsuitable. It should really have been given different name (strtrunc, perhaps) to make the intended use more obvious.