mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-11-30 08:43:23 +00:00
realpath(3) bug fix: There was an off-by-one error in computing the
size of the resulting canonical path.
This commit is contained in:
parent
ad3dbee7a1
commit
a9c8e89592
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/stable/3/; revision=118401
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user