Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 16 Jul 1999 01:38:24 +0200
From:      Sheldon Hearn <sheldonh@uunet.co.za>
To:        Warner Losh <imp@village.org>
Cc:        Paul Hart <hart@iserver.com>, freebsd-security@FreeBSD.ORG
Subject:   Re: OpenBSD's strlcpy(3) and strlcat(3) 
Message-ID:  <80530.932081904@axl.noc.iafrica.com>
In-Reply-To: Your message of "Thu, 15 Jul 1999 17:19:05 CST." <199907152319.RAA73667@harmony.village.org> 

next in thread | previous in thread | raw e-mail | index | archive | help


On Thu, 15 Jul 1999 17:19:05 CST, Warner Losh wrote:

> I *STRONGLY* support adding strl routines to FreeBSD's libc.  I've had
> them in my local library for a long time, but haven't had the time to
> commit them.

What do you think of this?

"
size_t
strlcpy(char *dst, char *src, size_t len [, shortfall]);

size_t
strlcat(char *dst, char *src, size_t len [, shortfall]);

[...]

RETURN VALUES

If the optional shortfall argument is passed non-zero, the functions
return the number of characters from src that are missing in dst after
the operation. Otherwise, they return the length of dst. In either case,
the return value does not include the NUL terminator.
"

This way, we get compatibility with the other vendors who've chosen to
implement the functions, but we also get the cheaper option Tim wants.
It'd be up to the other vendors to choose to implement the extension.

I'll come up with a commit candidate in the next 48 hours and post a
URL, including a manpage replacement. The OpenBSD manpage for these
functions includes in DESCRIPTION too much that should be in HISTORY
(and perhaps IMPLEMENTATION NOTES).

The only thing I can think of that would make this extension a bad idea
is va_alist processing cost. Is it significant?

Ciao,
Sheldon.


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




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