Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 15 Jul 1999 19:42:03 -0400
From:      Tim Vanderhoek <vanderh@ecf.utoronto.ca>
To:        Sheldon Hearn <sheldonh@uunet.co.za>
Cc:        freebsd-hackers@FreeBSD.org
Subject:   Re: OpenBSD's strlcpy(3) and strlcat(3)
Message-ID:  <19990715194203.A54146@mad>
In-Reply-To: <80092.932079193@axl.noc.iafrica.com>; from Sheldon Hearn on Fri, Jul 16, 1999 at 12:53:13AM %2B0200
References:  <19990715183442.A53661@mad> <80092.932079193@axl.noc.iafrica.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Jul 16, 1999 at 12:53:13AM +0200, Sheldon Hearn wrote:
> 
> If all you're saying is that you want an API that doesn't require a test
> against the known length of src (append in your example), then you won't
> like strl*. :-)

Well, if I read your message correctly, the difference between fooncat()
and strlcat() would be that strlcat() returns the total number of
chars in (or would be in) the destination string, whereas fooncat()
returns the total number of chars copied.  The former, strlcat(),
avoids the problem I was noting.

Looking at OpenBSD's actual definition of strlcat() which returns the
number of chars that would have been in the final string is
potentially non-useful, but not really toooooo terrible.

[If I'm using strlcat() in the first place, am I _really_ going to
 care how many chars would have been copied?  Maybe in legacy code,
 but in anything newer...]


> You'd probably prefer the functions to return the number of bytes which
> they did not manage to {copy,append}, yes? Lazy bastard [1]. :-)

Hmm...  That's an interesting idea...


> strl{cpy,cat}. And the original question was whether or not we'd add the
> strl{cpy,cat} functions to libc. If we do, I seriously hope I'll be

Ahh, well, you did hijack this off of the -security list.  Adding
strlcpy() and strlcat() is probably a good idea.


> given the opportunity to submit a replacement manpage, since theirs
> sucks.

Bah.  You're in avail now.  Just commit ontop of whatever manpage gets
imported.  ;-)  If your replacement is good, no one will object.  :)


-- 
This is my .signature which gets appended to the end of my messages.


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19990715194203.A54146>