summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdlib/realpath.c
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>1998-05-18 09:55:19 +0000
committerderaadt <deraadt@openbsd.org>1998-05-18 09:55:19 +0000
commita98daa6924e11ed7ecb2b2a8158f8bafc496d1dc (patch)
tree3e6fc4a8de981fccb7469575c7d7ef0018b3aad2 /lib/libc/stdlib/realpath.c
parentipfstat does not read from /vmunix (diff)
downloadwireguard-openbsd-a98daa6924e11ed7ecb2b2a8158f8bafc496d1dc.tar.xz
wireguard-openbsd-a98daa6924e11ed7ecb2b2a8158f8bafc496d1dc.zip
readlink(path, buf, sizeof buf-1). Never forget that -1.
Diffstat (limited to 'lib/libc/stdlib/realpath.c')
-rw-r--r--lib/libc/stdlib/realpath.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/libc/stdlib/realpath.c b/lib/libc/stdlib/realpath.c
index 78c286014dc..02886014649 100644
--- a/lib/libc/stdlib/realpath.c
+++ b/lib/libc/stdlib/realpath.c
@@ -35,7 +35,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char *rcsid = "$OpenBSD: realpath.c,v 1.3 1997/06/20 20:37:45 deraadt Exp $";
+static char *rcsid = "$OpenBSD: realpath.c,v 1.4 1998/05/18 09:55:19 deraadt Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/param.h>
@@ -105,7 +105,7 @@ loop:
errno = ELOOP;
goto err1;
}
- n = readlink(p, resolved, MAXPATHLEN);
+ n = readlink(p, resolved, MAXPATHLEN-1);
if (n < 0)
goto err1;
resolved[n] = '\0';