From 7c4d34d5bc76a9ae5ac236ce6b4d260448d69ccd Mon Sep 17 00:00:00 2001 From: deraadt <> Date: Fri, 24 May 2002 21:22:37 +0000 Subject: [PATCH] try to use strlcpy and snprintf more; ok various --- src/lib/libc/stdlib/realpath.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib/libc/stdlib/realpath.c b/src/lib/libc/stdlib/realpath.c index 061f1a7e..d01b19e0 100644 --- a/src/lib/libc/stdlib/realpath.c +++ b/src/lib/libc/stdlib/realpath.c @@ -35,7 +35,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: realpath.c,v 1.6 2002/01/12 16:24:35 millert Exp $"; +static char *rcsid = "$OpenBSD: realpath.c,v 1.7 2002/05/24 21:22:37 deraadt Exp $"; #endif /* LIBC_SCCS and not lint */ #include @@ -66,7 +66,7 @@ realpath(path, resolved) /* Save the starting point. */ if ((fd = open(".", O_RDONLY)) < 0) { - (void)strcpy(resolved, "."); + (void)strlcpy(resolved, ".", MAXPATHLEN); return (NULL); } @@ -125,7 +125,7 @@ loop: * Save the last component name and get the full pathname of * the current directory. */ - (void)strcpy(wbuf, p); + (void)strlcpy(wbuf, p, sizeof wbuf); if (getcwd(resolved, MAXPATHLEN) == 0) goto err1;