diff options
author | bde <bde@FreeBSD.org> | 1997-11-23 12:24:59 +0000 |
---|---|---|
committer | bde <bde@FreeBSD.org> | 1997-11-23 12:24:59 +0000 |
commit | 608663aedf97b58a40a7c2f93d69b5269d384759 (patch) | |
tree | c7143c8aa455d3e8872fcfaed138f1324dba2833 /sys/kern/kern_descrip.c | |
parent | f885907fbd45ecd99eb3bbe61420ef3107361755 (diff) | |
download | FreeBSD-src-608663aedf97b58a40a7c2f93d69b5269d384759.zip FreeBSD-src-608663aedf97b58a40a7c2f93d69b5269d384759.tar.gz |
Fixed a missing conversion of retval to p_retval in disabled code.
Fixed overflow of FFLAGS() in fcntl(F_SETFL, ...). This was not
a security hole, but gave wrong results for silly flags values.
E.g., it make fcntl(F_SETFL, -1) equivalent to fcntl(F_SETFL, 0).
POSIX requires ignoring the open mode bits in fcntl() (even if
they would be invalid for open()).
Diffstat (limited to 'sys/kern/kern_descrip.c')
-rw-r--r-- | sys/kern/kern_descrip.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index dd59915..9420480 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)kern_descrip.c 8.6 (Berkeley) 4/19/94 - * $Id: kern_descrip.c,v 1.43 1997/11/06 19:29:07 phk Exp $ + * $Id: kern_descrip.c,v 1.44 1997/11/23 10:43:43 bde Exp $ */ #include <sys/param.h> @@ -175,7 +175,7 @@ dup(p, uap) /* * XXX Compatibility */ - if (old &~ 077) { uap->fd &= 077; return (dup2(p, uap, retval)); } + if (old &~ 077) { uap->fd &= 077; return (dup2(p, uap, p->p_retval)); } #endif fdp = p->p_fd; @@ -239,7 +239,7 @@ fcntl(p, uap) case F_SETFL: fp->f_flag &= ~FCNTLFLAGS; - fp->f_flag |= FFLAGS(uap->arg) & FCNTLFLAGS; + fp->f_flag |= FFLAGS(uap->arg & ~O_ACCMODE) & FCNTLFLAGS; tmp = fp->f_flag & FNONBLOCK; error = (*fp->f_ops->fo_ioctl)(fp, FIONBIO, (caddr_t)&tmp, p); if (error) |