Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 16 Jul 1999 03:30:18 -0400
From:      Tim Vanderhoek <vanderh@ecf.utoronto.ca>
To:        Warner Losh <imp@village.org>
Cc:        Sheldon Hearn <sheldonh@uunet.co.za>, freebsd-hackers@FreeBSD.org
Subject:   Re: OpenBSD's strlcpy(3) and strlcat(3)
Message-ID:  <19990716033018.C54146@mad>
In-Reply-To: <199907160028.SAA01218@harmony.village.org>; from Warner Losh on Thu, Jul 15, 1999 at 06:28:52PM -0600
References:  <19990715194203.A54146@mad> <19990715183442.A53661@mad> <80092.932079193@axl.noc.iafrica.com> <19990715194203.A54146@mad> <199907160028.SAA01218@harmony.village.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Jul 15, 1999 at 06:28:52PM -0600, Warner Losh wrote:
>
> : 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.
> 
> No.  It is useful.  If you look at the return value, you can detect
> that an overflow would have happened and bail w/o having the overflow

No, they could simply return sizeof(buf) + 1 and have the same effect.
Running through the whole length of the string that would have been
created is potentially non-useful [sic].

It also potentially slows strlcat() down, particularly is some
programmers start to rely on its behaviour to find the new amount
of memory needed to allocate instead of doing the math themselves.


-- 
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?19990716033018.C54146>