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
This commit is contained in:
parent
6454a61bd7
commit
c7503f60c4
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user