aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJacques Vidrine <nectar@FreeBSD.org>2003-08-03 23:47:39 +0000
committerJacques Vidrine <nectar@FreeBSD.org>2003-08-03 23:47:39 +0000
commita9c8e89592ae857ac5cb29aadd34b826a6e1c005 (patch)
tree82e095d0911797fead8e5f3e30a17bfddac4cc50
parentad3dbee7a166a2a2c51e63d6b1ff3f15850766b4 (diff)
downloadsrc-a9c8e89592ae857ac5cb29aadd34b826a6e1c005.tar.gz
src-a9c8e89592ae857ac5cb29aadd34b826a6e1c005.zip
realpath(3) bug fix: There was an off-by-one error in computing the
size of the resulting canonical path.
Notes
Notes: svn path=/stable/3/; revision=118401
-rw-r--r--lib/libc/stdlib/realpath.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/libc/stdlib/realpath.c b/lib/libc/stdlib/realpath.c
index b5177e9c221c..a01a5a8116db 100644
--- a/lib/libc/stdlib/realpath.c
+++ b/lib/libc/stdlib/realpath.c
@@ -36,6 +36,8 @@
#if defined(LIBC_SCCS) && !defined(lint)
static char sccsid[] = "@(#)realpath.c 8.1 (Berkeley) 2/16/94";
+static char rcsid[] =
+"$FreeBSD$";
#endif /* LIBC_SCCS and not lint */
#include <sys/param.h>
@@ -136,7 +138,8 @@ loop:
rootd = 0;
if (*wbuf) {
- if (strlen(resolved) + strlen(wbuf) + rootd + 1 > MAXPATHLEN) {
+ if (strlen(resolved) + strlen(wbuf) + (1-rootd) + 1 >
+ MAXPATHLEN) {
errno = ENAMETOOLONG;
goto err1;
}