Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 17 Jan 2001 13:47:51 -0500
From:      Chris Faulhaber <jedgar@fxp.org>
To:        Warner Losh <imp@harmony.village.org>
Cc:        freebsd-audit@FreeBSD.ORG
Subject:   Re: strlcat fixes
Message-ID:  <20010117134751.A23603@earth.causticlabs.com>
In-Reply-To: <200101162313.f0GNDCs32370@harmony.village.org>; from imp@harmony.village.org on Tue, Jan 16, 2001 at 04:13:11PM -0700
References:  <20010116180751.A67654@peitho.fxp.org> <20010116174845.A95772@peitho.fxp.org> <200101162305.f0GN51s32264@harmony.village.org> <20010116180751.A67654@peitho.fxp.org> <200101162313.f0GNDCs32370@harmony.village.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Jan 16, 2001 at 04:13:11PM -0700, Warner Losh wrote:
> In message <20010116180751.A67654@peitho.fxp.org> Chris Faulhaber writes:
> : Actually, OpenBSD merged the changes last week:
> 
> Well then, that's a good reason for me :-)
> 

While I am at it, how about the following to sync the verbage with
OpenBSD's man page:

-     larger than 0).  Note that you should include a byte for the NUL in size.
+     larger than 0 or, in the case of strlcat(), as long as there is at least
+     one byte free in dst).  Note that you should include a byte for the NUL
+     in size.  Also note that strlcpy() and strlcat() only operate on true
+     ``C'' strings.  This means that for strlcpy() src must be NUL-terminated
+     and for strlcat() both src and dst must be NUL-terminated.

-- 
Chris D. Faulhaber - jedgar@fxp.org - jedgar@FreeBSD.org
--------------------------------------------------------
FreeBSD: The Power To Serve   -   http://www.FreeBSD.org

Index: strlcpy.3
===================================================================
RCS file: /home/ncvs/src/lib/libc/string/strlcpy.3,v
retrieving revision 1.7
diff -u -r1.7 strlcpy.3
--- strlcpy.3	2000/12/29 14:08:04	1.7
+++ strlcpy.3	2001/01/17 18:44:17
@@ -59,8 +59,29 @@
 take the full size of the buffer (not just the length) and guarantee to
 NUL-terminate the result (as long as
 .Fa size
-is larger than 0).  Note that you should include a byte for the NUL in
+is larger than 0 or, in the case of
+.Fn strlcat ,
+as long as there is at least one byte free in
+.Fa dst ) .
+Note that you should include a byte for the NUL in
 .Fa size .
+Also note that
+.Fn strlcpy  
+and
+.Fn strlcat
+only operate on true
+.Dq C
+strings.
+This means that for
+.Fn strlcpy
+.Fa src
+must be NUL-terminated and for
+.Fn strlcat
+both
+.Fa src
+and
+.Fa dst
+must be NUL-terminated.
 .Pp
 The
 .Fn strlcpy


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




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