From 28d4992f851dc49b5d98e6bfd77e7517f03b3507 Mon Sep 17 00:00:00 2001 From: Philip Guenther Date: Thu, 14 Jul 2016 05:55:09 +0000 Subject: Prevent silly states via knotes on pids > 2^32 and on nonexistent signals. ok tedu@ --- sys/kern/kern_sig.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'sys/kern/kern_sig.c') diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c index 0d9eb786495..374e58d9bc4 100644 --- a/sys/kern/kern_sig.c +++ b/sys/kern/kern_sig.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_sig.c,v 1.201 2016/07/06 15:53:01 tedu Exp $ */ +/* $OpenBSD: kern_sig.c,v 1.202 2016/07/14 05:55:08 guenther Exp $ */ /* $NetBSD: kern_sig.c,v 1.54 1996/04/22 01:38:32 christos Exp $ */ /* @@ -1824,6 +1824,9 @@ filt_sigattach(struct knote *kn) { struct process *pr = curproc->p_p; + if (kn->kn_id >= NSIG) + return EINVAL; + kn->kn_ptr.p_process = pr; kn->kn_flags |= EV_CLEAR; /* automatically set */ -- cgit v1.2.3