diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2015-04-30 21:18:46 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2015-04-30 21:18:46 +0000 |
commit | b4dd5ae7559a277e240f419d5c44de12145160f8 (patch) | |
tree | d432bb630d4efc8fe1b6735444ea6dbc2f8848fe /sys | |
parent | f022ac7ba3bfa4ad3f9735895b1c852d8b7bcbbb (diff) |
Avoid NULL deref in fd_getfile_mode(); OK deraadt@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/kern_descrip.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index 2c8955c4d01..93d6a9c4cfe 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_descrip.c,v 1.118 2015/04/30 09:20:51 mpi Exp $ */ +/* $OpenBSD: kern_descrip.c,v 1.119 2015/04/30 21:18:45 millert Exp $ */ /* $NetBSD: kern_descrip.c,v 1.42 1996/03/30 22:24:38 christos Exp $ */ /* @@ -201,7 +201,7 @@ fd_getfile_mode(struct filedesc *fdp, int fd, int mode) fp = fd_getfile(fdp, fd); - if ((fp->f_flag & mode) == 0) + if (fp == NULL || (fp->f_flag & mode) == 0) return (NULL); return (fp); |