From 9e2f66dbed2934fd5d9fb26b81ba24f437e9ae31 Mon Sep 17 00:00:00 2001 From: deraadt <> Date: Mon, 18 May 1998 09:55:19 +0000 Subject: readlink(path, buf, sizeof buf-1). Never forget that -1. --- src/lib/libc/stdlib/realpath.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/libc/stdlib/realpath.c b/src/lib/libc/stdlib/realpath.c index 78c286014d..0288601464 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.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 @@ -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'; -- cgit v1.2.3-55-g6feb