Author: tuexen
Date: Thu Sep 10 12:01:35 2020
New Revision: 365565
URL: https://svnweb.freebsd.org/changeset/base/365565

Log:
  MFC r361081:
  
  Allow only IPv4 addresses in sendto() for TCP on AF_INET sockets.
  
  This problem was found by looking at syzkaller reproducers for some other
  problems.

Modified:
  stable/12/sys/netinet/tcp_usrreq.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/netinet/tcp_usrreq.c
==============================================================================
--- stable/12/sys/netinet/tcp_usrreq.c  Thu Sep 10 11:55:45 2020        
(r365564)
+++ stable/12/sys/netinet/tcp_usrreq.c  Thu Sep 10 12:01:35 2020        
(r365565)
@@ -1032,6 +1032,12 @@ tcp_usr_send(struct socket *so, int flags, struct mbuf
                                error = EINVAL;
                                goto out;
                        }
+                       if ((inp->inp_vflag & INP_IPV6PROTO) == 0) {
+                               if (m != NULL)
+                                       m_freem(m);
+                               error = EAFNOSUPPORT;
+                               goto out;
+                       }
                        if (IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr)) {
                                if (m)
                                        m_freem(m);
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to