diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1996-12-17 02:38:40 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1996-12-17 02:38:40 +0000 |
commit | 5ab777dc75b17b54c14b6c1bdda9e4b3e9201bf9 (patch) | |
tree | 916033d3ed9cb65c9fa26ab64c9cefdf7839be48 | |
parent | f4fe840df4b53434402d6b1f80b3f887a27b2162 (diff) |
strncpy that strerror, found by oliver@secnet.com
-rw-r--r-- | lib/libc/compat-43/getwd.c | 5 |
1 files changed, 3 insertions, 2 deletions
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 <sys/param.h> @@ -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); } |