Avoid panic triggered by rename("foo/", "bar/..") (From Mycroft)

This commit is contained in:
christos 1997-06-26 22:23:17 +00:00
parent 4c2700de65
commit b59135a6fb
2 changed files with 8 additions and 4 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: msdosfs_vnops.c,v 1.57 1997/05/08 16:45:02 mycroft Exp $ */
/* $NetBSD: msdosfs_vnops.c,v 1.58 1997/06/26 22:24:00 christos Exp $ */
/*-
* Copyright (C) 1994, 1995 Wolfgang Solfrank.
@ -940,7 +940,9 @@ abortit:
* Avoid ".", "..", and aliases of "." for obvious reasons.
*/
if ((fcnp->cn_namelen == 1 && fcnp->cn_nameptr[0] == '.') ||
dp == ip || (fcnp->cn_flags & ISDOTDOT) ||
dp == ip ||
(fcnp->cn_flags & ISDOTDOT) ||
(tcnp->cn_flags & ISDOTDOT) ||
(ip->de_flag & DE_RENAME)) {
VOP_UNLOCK(fvp);
error = EINVAL;

View File

@ -1,4 +1,4 @@
/* $NetBSD: ufs_vnops.c,v 1.26 1997/06/11 10:10:19 bouyer Exp $ */
/* $NetBSD: ufs_vnops.c,v 1.27 1997/06/26 22:23:17 christos Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1993
@ -853,7 +853,9 @@ abortit:
* Avoid ".", "..", and aliases of "." for obvious reasons.
*/
if ((fcnp->cn_namelen == 1 && fcnp->cn_nameptr[0] == '.') ||
dp == ip || (fcnp->cn_flags&ISDOTDOT) ||
dp == ip ||
(fcnp->cn_flags & ISDOTDOT) ||
(tcnp->cn_flags & ISDOTDOT) ||
(ip->i_flag & IN_RENAME)) {
VOP_UNLOCK(fvp);
error = EINVAL;