summaryrefslogtreecommitdiff
path: root/sys/kern/kern_sig.c
diff options
context:
space:
mode:
authorPhilip Guenther <guenther@cvs.openbsd.org>2016-07-14 05:55:09 +0000
committerPhilip Guenther <guenther@cvs.openbsd.org>2016-07-14 05:55:09 +0000
commit28d4992f851dc49b5d98e6bfd77e7517f03b3507 (patch)
tree803f057174952615bb57d2a6601460af251cd921 /sys/kern/kern_sig.c
parent459430503e1b38161d2b432e58704502d68bdef5 (diff)
Prevent silly states via knotes on pids > 2^32 and on nonexistent signals.
ok tedu@
Diffstat (limited to 'sys/kern/kern_sig.c')
-rw-r--r--sys/kern/kern_sig.c5
1 files changed, 4 insertions, 1 deletions
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 */