[open-source] Re: Wish for 2002 ...

mouring@etoh.eviladmin.org mouring@etoh.eviladmin.org
Fri Jan 11 11:19:00 GMT 2002



On Fri, 11 Jan 2002, Linus Torvalds wrote:

>
> On Fri, 11 Jan 2002, Markus Friedl wrote:
>
> > On Thu, Jan 10, 2002 at 04:37:27PM -0800, Paul Eggert wrote:
> > > 	len = strlen(challenge) + strlen(PROMPT) + 1;
> > > 	p = xmalloc(len);
> > > 	p[0] = '\0';
> > > 	strlcat(p, challenge, len);
	^^ This really should be strlcpy() and the p[0] line should be
deleted  it makes really no sense to concat to an blank string.

No where else do we do this unless we are in a loop where we can not use
strlcpy() to create a base string (or that I see off hand).

p[0]='\0'
while (..) {
	if (..)
		strlcat(..)
}

- Ben



More information about the Libc-alpha mailing list