From 96a041b533fc8fa37f3e44d8be907ff863eef55a Mon Sep 17 00:00:00 2001 From: "Matthew N. Dodd" Date: Wed, 20 Apr 2005 02:57:56 +0000 Subject: [PATCH] Check sopt_level in uipc_ctloutput() and return early if it is non-zero. This prevents unintended consequnces when an application calls things like setsockopt(x, SOL_SOCKET, SO_REUSEADDR, ...) on a Unix domain socket. --- sys/kern/uipc_usrreq.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/kern/uipc_usrreq.c b/sys/kern/uipc_usrreq.c index e3ebf9ba9cc..327026df093 100644 --- a/sys/kern/uipc_usrreq.c +++ b/sys/kern/uipc_usrreq.c @@ -617,6 +617,9 @@ uipc_ctloutput(struct socket *so, struct sockopt *sopt) struct xucred xu; int error, optval; + if (sopt->sopt_level != 0) + return (EINVAL); + UNP_LOCK(); unp = sotounpcb(so); if (unp == NULL) {