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.
This commit is contained in:
Matthew N. Dodd 2005-04-20 02:57:56 +00:00
parent a378bbabe6
commit 96a041b533

View File

@ -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) {