diff options
| author | 2001-06-27 00:58:53 +0000 | |
|---|---|---|
| committer | 2001-06-27 00:58:53 +0000 | |
| commit | f1a075da3e4bb4f84a5bb83783c6b1943dc3da49 (patch) | |
| tree | f3b98ca6be26aa2b00a7770f1dceff5312265655 /lib/libc/stdlib/realpath.c | |
| parent | Keep track of the ACQUIRE sequence number, and pass it to the kernel (diff) | |
| download | wireguard-openbsd-f1a075da3e4bb4f84a5bb83783c6b1943dc3da49.tar.xz wireguard-openbsd-f1a075da3e4bb4f84a5bb83783c6b1943dc3da49.zip | |
use strlcpy vs strncpy+a[len-1]='\0'. millert@ ok.
Diffstat (limited to 'lib/libc/stdlib/realpath.c')
| -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) { |
