Date: Sat, 23 Jul 2016 08:02:46 +0000 (UTC) From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r303214 - stable/10/sys/kern Message-ID: <201607230802.u6N82k8X028393@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kib Date: Sat Jul 23 08:02:45 2016 New Revision: 303214 URL: https://svnweb.freebsd.org/changeset/base/303214 Log: MFC r302936: Explicitely check for the valid range of file descriptor values. Modified: stable/10/sys/kern/kern_event.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/kern_event.c ============================================================================== --- stable/10/sys/kern/kern_event.c Sat Jul 23 06:30:00 2016 (r303213) +++ stable/10/sys/kern/kern_event.c Sat Jul 23 08:02:45 2016 (r303214) @@ -1083,8 +1083,11 @@ kqueue_register(struct kqueue *kq, struc findkn: if (fops->f_isfd) { KASSERT(td != NULL, ("td is NULL")); - error = fget(td, kev->ident, - cap_rights_init(&rights, CAP_EVENT), &fp); + if (kev->ident > INT_MAX) + error = EBADF; + else + error = fget(td, kev->ident, + cap_rights_init(&rights, CAP_EVENT), &fp); if (error) goto done;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201607230802.u6N82k8X028393>