summaryrefslogtreecommitdiffstats
path: root/sys/netinet
diff options
context:
space:
mode:
authorvgross <vgross@openbsd.org>2015-09-11 13:59:27 +0000
committervgross <vgross@openbsd.org>2015-09-11 13:59:27 +0000
commit90c838940b1f1621f13d24a66bfa22bef232e574 (patch)
tree3aa199ad9f604e535060d84d0ae107912a56b767 /sys/netinet
parentdocument tls_get_peer_subject, tls_get_peer_issuer, and tls_get_peer_hash (diff)
downloadwireguard-openbsd-90c838940b1f1621f13d24a66bfa22bef232e574.tar.xz
wireguard-openbsd-90c838940b1f1621f13d24a66bfa22bef232e574.zip
Stricter checks on sockaddr content when binding PF_INET sockets.
Ok mpi@
Diffstat (limited to 'sys/netinet')
-rw-r--r--sys/netinet/in_pcb.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c
index 9ae95ee70e8..98650eb58e6 100644
--- a/sys/netinet/in_pcb.c
+++ b/sys/netinet/in_pcb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: in_pcb.c,v 1.177 2015/09/11 08:22:31 guenther Exp $ */
+/* $OpenBSD: in_pcb.c,v 1.178 2015/09/11 13:59:27 vgross Exp $ */
/* $NetBSD: in_pcb.c,v 1.25 1996/02/13 23:41:53 christos Exp $ */
/*
@@ -302,14 +302,10 @@ in_pcbbind(struct inpcb *inp, struct mbuf *nam, struct proc *p)
sin = mtod(nam, struct sockaddr_in *);
if (nam->m_len != sizeof(*sin))
return (EINVAL);
-#ifdef notdef
- /*
- * We should check the family, but old programs
- * incorrectly fail to initialize it.
- */
+
if (sin->sin_family != AF_INET)
return (EAFNOSUPPORT);
-#endif
+
lport = sin->sin_port;
if (IN_MULTICAST(sin->sin_addr.s_addr)) {
/*