From: gerhard Date: Tue, 20 Jun 2017 14:11:46 +0000 (+0000) Subject: Do not touch file pointers for which FILE_IS_USABLE() is false. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=608dd9d157c752796f552d21c6e9d8296abd7990;p=openbsd Do not touch file pointers for which FILE_IS_USABLE() is false. They're might not be fully constructed. ok mpi@ deraadt@ bluhm@ --- diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c index 16d1d279036..7b71ccfde26 100644 --- a/sys/kern/kern_sysctl.c +++ b/sys/kern/kern_sysctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_sysctl.c,v 1.328 2017/06/14 03:00:40 dlg Exp $ */ +/* $OpenBSD: kern_sysctl.c,v 1.329 2017/06/20 14:11:46 gerhard Exp $ */ /* $NetBSD: kern_sysctl.c,v 1.17 1996/05/20 17:49:05 mrg Exp $ */ /*- @@ -1327,6 +1327,7 @@ sysctl_file(int *name, u_int namelen, char *where, size_t *sizep, FREF(fp); do { if (fp->f_count > 1 && /* 0, +1 for our FREF() */ + FILE_IS_USABLE(fp) && (arg == 0 || fp->f_type == arg)) { int af, skip = 0; if (arg == DTYPE_SOCKET && fp->f_type == arg) {