diff options
author | lebel <lebel@cvs.openbsd.org> | 2001-06-27 00:58:58 +0000 |
---|---|---|
committer | lebel <lebel@cvs.openbsd.org> | 2001-06-27 00:58:58 +0000 |
commit | 8af9ac2691950c45385aecf7c502a16c3c11db86 (patch) | |
tree | 2b4161da48e1261faa9895ae08bd1fcdf3be38a3 /lib/libc/stdlib | |
parent | c5355883f033c52fa97b73febb89e80adf21cbbd (diff) |
use strlcpy vs strncpy+a[len-1]='\0'. millert@ ok.
Diffstat (limited to 'lib/libc/stdlib')
-rw-r--r-- | lib/libc/stdlib/realpath.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/libc/stdlib/realpath.c b/lib/libc/stdlib/realpath.c index 02886014649..a6195c1dcbd 100644 --- a/lib/libc/stdlib/realpath.c +++ b/lib/libc/stdlib/realpath.c @@ -35,7 +35,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: realpath.c,v 1.4 1998/05/18 09:55:19 deraadt Exp $"; +static char *rcsid = "$OpenBSD: realpath.c,v 1.5 2001/06/27 00:58:56 lebel Exp $"; #endif /* LIBC_SCCS and not lint */ #include <sys/param.h> @@ -78,8 +78,7 @@ realpath(path, resolved) * if it is a directory, then change to that directory. * get the current directory name and append the basename. */ - (void)strncpy(resolved, path, MAXPATHLEN - 1); - resolved[MAXPATHLEN - 1] = '\0'; + strlcpy(resolved, path, MAXPATHLEN); loop: q = strrchr(resolved, '/'); if (q != NULL) { |