diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1997-11-17 06:00:53 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1997-11-17 06:00:53 +0000 |
commit | 56ddb51a6a65e36924276ea742a9954979bf6054 (patch) | |
tree | 423195a4bcf51716dbf260b95f93aa0020b6a1c9 /sys/kern | |
parent | cf9c1e76089fd1293806c61cbde28ba306f78d75 (diff) |
make chmod() and fchmod() return EINVAL for bad mode bits
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/vfs_syscalls.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index 83dc7e79bc3..6aea61f5fa4 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_syscalls.c,v 1.28 1997/11/06 05:58:29 csapuntz Exp $ */ +/* $OpenBSD: vfs_syscalls.c,v 1.29 1997/11/17 06:00:52 deraadt Exp $ */ /* $NetBSD: vfs_syscalls.c,v 1.71 1996/04/23 10:29:02 mycroft Exp $ */ /* @@ -1529,6 +1529,9 @@ sys_chmod(p, v, retval) int error; struct nameidata nd; + if (SCARG(uap, mode) & ~ALLPERMS) + return (EINVAL); + NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, SCARG(uap, path), p); if ((error = namei(&nd)) != 0) return (error); @@ -1565,6 +1568,9 @@ sys_fchmod(p, v, retval) struct file *fp; int error; + if (SCARG(uap, mode) & ~ALLPERMS) + return (EINVAL); + if ((error = getvnode(p->p_fd, SCARG(uap, fd), &fp)) != 0) return (error); vp = (struct vnode *)fp->f_data; |