diff options
author | bde <bde@FreeBSD.org> | 1996-12-01 16:05:44 +0000 |
---|---|---|
committer | bde <bde@FreeBSD.org> | 1996-12-01 16:05:44 +0000 |
commit | 83d353ee92777e757e5a9a45e7dbe3a470befa83 (patch) | |
tree | 8f1e3c321430ab683a7dead3943c6423aeaec346 /sys/kern/vfs_lookup.c | |
parent | e30058b4a4dd11ef7501554cdb4106efae507b72 (diff) | |
download | FreeBSD-src-83d353ee92777e757e5a9a45e7dbe3a470befa83.zip FreeBSD-src-83d353ee92777e757e5a9a45e7dbe3a470befa83.tar.gz |
Don't allow empty pathnames. POSIX standard.
Most of the standard utilities that depended on (or were broken in
a different way by) the old behaviour of interpreting "" as "."
were fixed a year or two ago. There is still a fairly harmless
bug in tar and a harmless bug in gzip. Tar apparently replaces
"/" by "" when it strips leading slashes.
Diffstat (limited to 'sys/kern/vfs_lookup.c')
-rw-r--r-- | sys/kern/vfs_lookup.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c index 6c40c0c..bad4414 100644 --- a/sys/kern/vfs_lookup.c +++ b/sys/kern/vfs_lookup.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)vfs_lookup.c 8.4 (Berkeley) 2/16/94 - * $Id: vfs_lookup.c,v 1.10 1995/10/22 09:32:25 davidg Exp $ + * $Id: vfs_lookup.c,v 1.11 1996/01/03 21:42:22 wollman Exp $ */ #include "opt_ktrace.h" @@ -112,6 +112,13 @@ namei(ndp) else error = copyinstr(ndp->ni_dirp, cnp->cn_pnbuf, MAXPATHLEN, (u_int *)&ndp->ni_pathlen); + + /* + * Don't allow empty pathnames. + */ + if (!error && *cnp->cn_pnbuf == '\0') + error = ENOENT; + if (error) { free(cnp->cn_pnbuf, M_NAMEI); ndp->ni_vp = NULL; |