From 7030319e02dca27e580c2d54af0f2a7ff9cd16e4 Mon Sep 17 00:00:00 2001 From: johan Date: Sat, 22 Feb 2003 18:08:34 +0000 Subject: Use strlcpy instead of strncpy. Submitted by: imp Reviewed by: silence on -audit --- lib/libc/stdlib/realpath.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'lib/libc/stdlib') diff --git a/lib/libc/stdlib/realpath.c b/lib/libc/stdlib/realpath.c index 8429986..eff5d23 100644 --- a/lib/libc/stdlib/realpath.c +++ b/lib/libc/stdlib/realpath.c @@ -82,8 +82,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, PATH_MAX - 1); - resolved[PATH_MAX - 1] = '\0'; + (void)strlcpy(resolved, path, PATH_MAX); loop: q = strrchr(resolved, '/'); if (q != NULL) { -- cgit v1.1