Date: Sat, 23 Jul 2016 08:06:50 +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-9@freebsd.org Subject: svn commit: r303215 - stable/9/sys/kern Message-ID: <201607230806.u6N86ox3028584@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kib Date: Sat Jul 23 08:06:50 2016 New Revision: 303215 URL: https://svnweb.freebsd.org/changeset/base/303215 Log: MFC r302936: Explicitely check for the valid range of file descriptor values. Modified: stable/9/sys/kern/kern_event.c Directory Properties: stable/9/ (props changed) stable/9/sys/ (props changed) Modified: stable/9/sys/kern/kern_event.c ============================================================================== --- stable/9/sys/kern/kern_event.c Sat Jul 23 08:02:45 2016 (r303214) +++ stable/9/sys/kern/kern_event.c Sat Jul 23 08:06:50 2016 (r303215) @@ -986,7 +986,10 @@ kqueue_register(struct kqueue *kq, struc findkn: if (fops->f_isfd) { KASSERT(td != NULL, ("td is NULL")); - error = fget(td, kev->ident, CAP_POLL_EVENT, &fp); + if (kev->ident > INT_MAX) + error = EBADF; + else + error = fget(td, kev->ident, CAP_POLL_EVENT, &fp); if (error) goto done;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201607230806.u6N86ox3028584>