diff options
author | 1996-12-17 02:38:39 +0000 | |
---|---|---|
committer | 1996-12-17 02:38:39 +0000 | |
commit | 0786dfdb01858ecc2632ae547298dbc94e86a2c1 (patch) | |
tree | 7004a10b2ff9a8051dd66073c67df7a7d703b0b0 /lib/libc | |
parent | use snprintf when storing the string from strerror(). Who knows how (diff) | |
download | wireguard-openbsd-0786dfdb01858ecc2632ae547298dbc94e86a2c1.tar.xz wireguard-openbsd-0786dfdb01858ecc2632ae547298dbc94e86a2c1.zip |
strncpy that strerror, found by oliver@secnet.com
Diffstat (limited to 'lib/libc')
-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); } |