diff options
author | imp <imp@FreeBSD.org> | 1999-08-10 05:58:58 +0000 |
---|---|---|
committer | imp <imp@FreeBSD.org> | 1999-08-10 05:58:58 +0000 |
commit | bedbde67f9d8aaa2cfc9543034594c777c88681f (patch) | |
tree | 824310c2514c6caca9b046c68318fdd421c5e897 /lib/libc/string/strlcat.c | |
parent | d27613c67e8bb774f79ec9f36cbdd02b14fcee73 (diff) | |
download | FreeBSD-src-bedbde67f9d8aaa2cfc9543034594c777c88681f.zip FreeBSD-src-bedbde67f9d8aaa2cfc9543034594c777c88681f.tar.gz |
Use the latest version of these files from OpenBSD.
1) Safty change from casper dik was added to OpenBSD's sources since I
grabbed them. milltert@openbsd.org
2) Split up strlcpy to improve efficiency of the common case.
milltert@openbsd.org
3) Cleanup of cross references for man page. {alex,aaron}@openbsd.org
Pointed out by: deraadt@openbsd.org
Diffstat (limited to 'lib/libc/string/strlcat.c')
-rw-r--r-- | lib/libc/string/strlcat.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/libc/string/strlcat.c b/lib/libc/string/strlcat.c index 2e8c569..599994e 100644 --- a/lib/libc/string/strlcat.c +++ b/lib/libc/string/strlcat.c @@ -1,4 +1,4 @@ -/* $OpenBSD: strlcat.c,v 1.1 1998/07/01 01:29:45 millert Exp $ */ +/* $OpenBSD: strlcat.c,v 1.2 1999/06/17 16:28:58 millert Exp $ */ /* * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com> @@ -28,7 +28,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: strlcat.c,v 1.1 1998/07/01 01:29:45 millert Exp $"; +static char *rcsid = "$OpenBSD: strlcat.c,v 1.2 1999/06/17 16:28:58 millert Exp $"; #endif /* LIBC_SCCS and not lint */ #include <sys/types.h> @@ -50,11 +50,11 @@ size_t strlcat(dst, src, siz) register size_t n = siz; size_t dlen; - /* Find the end of dst and adjust bytes left */ - while (*d != '\0' && n != 0) + /* Find the end of dst and adjust bytes left but don't go past end */ + while (*d != '\0' && n-- != 0) d++; dlen = d - dst; - n -= dlen; + n = siz - dlen; if (n == 0) return(dlen + strlen(s)); |