From owner-freebsd-hackers Thu Jul 15 16:45:13 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from smtp11.bellglobal.com (smtp11.bellglobal.com [204.101.251.53]) by hub.freebsd.org (Postfix) with ESMTP id 0248A1562C for ; Thu, 15 Jul 1999 16:45:10 -0700 (PDT) (envelope-from hoek@FreeBSD.org) Received: from localhost.nowhere (ppp18386.on.bellglobal.com [206.172.130.66]) by smtp11.bellglobal.com (8.8.5/8.8.5) with ESMTP id TAA01878; Thu, 15 Jul 1999 19:45:50 -0400 (EDT) Received: (from tim@localhost) by localhost.nowhere (8.9.3/8.9.1) id TAA54221; Thu, 15 Jul 1999 19:42:04 -0400 (EDT) (envelope-from tim) Date: Thu, 15 Jul 1999 19:42:03 -0400 From: Tim Vanderhoek To: Sheldon Hearn Cc: freebsd-hackers@FreeBSD.org Subject: Re: OpenBSD's strlcpy(3) and strlcat(3) Message-ID: <19990715194203.A54146@mad> References: <19990715183442.A53661@mad> <80092.932079193@axl.noc.iafrica.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.95i In-Reply-To: <80092.932079193@axl.noc.iafrica.com>; from Sheldon Hearn on Fri, Jul 16, 1999 at 12:53:13AM +0200 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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