From f1a075da3e4bb4f84a5bb83783c6b1943dc3da49 Mon Sep 17 00:00:00 2001 From: lebel Date: Wed, 27 Jun 2001 00:58:53 +0000 Subject: use strlcpy vs strncpy+a[len-1]='\0'. millert@ ok. --- lib/libc/stdlib/realpath.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'lib/libc/stdlib/realpath.c') 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 @@ -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) { -- cgit v1.2.3-59-g8ed1b