From 5ab777dc75b17b54c14b6c1bdda9e4b3e9201bf9 Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Tue, 17 Dec 1996 02:38:40 +0000 Subject: strncpy that strerror, found by oliver@secnet.com --- lib/libc/compat-43/getwd.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lib/libc/compat-43/getwd.c') diff --git a/lib/libc/compat-43/getwd.c b/lib/libc/compat-43/getwd.c index 7557ac43a50..12880a9c49c 100644 --- a/lib/libc/compat-43/getwd.c +++ b/lib/libc/compat-43/getwd.c @@ -32,7 +32,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: getwd.c,v 1.2 1996/08/19 08:19:24 tholo Exp $"; +static char *rcsid = "$OpenBSD: getwd.c,v 1.3 1996/12/17 02:38:39 deraadt Exp $"; #endif /* LIBC_SCCS and not lint */ #include @@ -49,6 +49,7 @@ getwd(buf) if (p = getcwd(buf, MAXPATHLEN)) return(p); - (void)strcpy(buf, strerror(errno)); + (void)strncpy(buf, strerror(errno), MAXPATHLEN-1); + buf[MAXPATHLEN-1] = '\0'; return((char *)NULL); } -- cgit v1.2.3