This is the mail archive of the
mailing list for the glibc project.
Re: Wish for 2002 ...
On Thu, Jan 10, 2002 at 04:37:27PM -0800, Paul Eggert wrote:
> len = strlen(challenge) + strlen(PROMPT) + 1;
> p = xmalloc(len);
> p = '\0';
> strlcat(p, challenge, len);
> strlcat(p, PROMPT, len);
> Here, the use of strlcat is redundant: strcat would do just as well,
> and would be clearer, smaller, and no doubt faster.
> I expect your other examples are similar.
The code will not be converted to use strcat().
OpenSSH will continue to promote strlcat() and strlcpy(),
regardless of who thinks this is a stupid choice.
The strlcat/strlcpy interface is consistent, whereas
strncat/strncpy is not. As to strcpy/strcat, it's to
easy to introduce bugs by using them.