quirk: uint64 to int32 truncation can lead to false positives, and then
later in the array sizing code, very big mallocs panic the kernel.
add a check that the ident isn't larger than INT_MAX in the fd case.
reported by Tim Newsham
-/* $OpenBSD: kern_event.c,v 1.72 2016/05/13 19:05:07 tedu Exp $ */
+/* $OpenBSD: kern_event.c,v 1.73 2016/07/14 02:35:17 tedu Exp $ */
/*-
* Copyright (c) 1999,2000,2001 Jonathan Lemon <jlemon@FreeBSD.org>
if (fops->f_isfd) {
/* validate descriptor */
+ if (kev->ident > INT_MAX)
+ return (EBADF);
if ((fp = fd_getfile(fdp, kev->ident)) == NULL)
return (EBADF);
FREF(fp);