diff options
author | dillon <dillon@FreeBSD.org> | 2001-06-24 05:24:41 +0000 |
---|---|---|
committer | dillon <dillon@FreeBSD.org> | 2001-06-24 05:24:41 +0000 |
commit | f8016646a9c26afbad95d7ae2f1e61e133264b78 (patch) | |
tree | c38c78db94089316cee7deabcf5f564578f119e4 | |
parent | 4127c8a65926144ea34c530e54ceba7b329bec88 (diff) | |
download | FreeBSD-src-f8016646a9c26afbad95d7ae2f1e61e133264b78.zip FreeBSD-src-f8016646a9c26afbad95d7ae2f1e61e133264b78.tar.gz |
After exhaustive discussions and some meandering and confusion, enough
people are on track with the cause and effect of this, and although
fixing this severely degenerate case appears to violate the letter of
POSIX.1-200x, Bruce and I (and enough others) agree that it should be
comitted.
So, this patch generates an ENOENT error for any attempt to do a path lookup
through an empty symlink (e.g. open(), stat()).
Submitted by: "Andrey A. Chernov" <ache@nagual.pp.ru>
Reviewed by: bde
Discussed exhaustively on: freebsd-current
Previously committed to: NetBSD 4 years ago
-rw-r--r-- | sys/kern/vfs_lookup.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c index 0ad9d65..4875533 100644 --- a/sys/kern/vfs_lookup.c +++ b/sys/kern/vfs_lookup.c @@ -214,6 +214,12 @@ namei(ndp) break; } linklen = MAXPATHLEN - auio.uio_resid; + if (linklen == 0) { + if (ndp->ni_pathlen > 1) + zfree(namei_zone, cp); + error = ENOENT; + break; + } if (linklen + ndp->ni_pathlen >= MAXPATHLEN) { if (ndp->ni_pathlen > 1) zfree(namei_zone, cp); |