Gert Doering has submitted this change. ( 
https://gerrit.openvpn.net/c/openvpn/+/2327?usp=email )

Change subject: socket_util: check the address family in addr_match() and 
addr_port_match()
......................................................................

socket_util: check the address family in addr_match() and addr_port_match()

Both read a2 as if it had a1's address family. The arguments are
openvpn_sockaddr unions, so the reads stay in bounds, but a mixed pair
compared an IPv4 address against sin6_flowinfo, or an IPv6 address
against sin_zero and the bytes after it. Mixed pairs reach
link_socket_actual_match() when a client floats between an IPv4 and an
IPv6 --local. Return no match for a different family, as
addrlist_match() does.

Change-Id: Idd4d71d02bafece74871a8b88b1c12d03d58540f
Signed-off-by: Razvan Cojocaru <[email protected]>
Acked-by: Frank Lichtenheld <[email protected]>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/2327
Message-Id: <[email protected]>
URL: 
https://www.mail-archive.com/[email protected]/msg41832.html
Signed-off-by: Gert Doering <[email protected]>
---
M src/openvpn/socket_util.h
1 file changed, 8 insertions(+), 0 deletions(-)




diff --git a/src/openvpn/socket_util.h b/src/openvpn/socket_util.h
index e85f6fe..a7821df 100644
--- a/src/openvpn/socket_util.h
+++ b/src/openvpn/socket_util.h
@@ -294,6 +294,10 @@
 static inline bool
 addr_match(const struct openvpn_sockaddr *a1, const struct openvpn_sockaddr 
*a2)
 {
+    if (a1->addr.sa.sa_family != a2->addr.sa.sa_family)
+    {
+        return false;
+    }
     switch (a1->addr.sa.sa_family)
     {
         case AF_INET:
@@ -381,6 +385,10 @@
 static inline bool
 addr_port_match(const struct openvpn_sockaddr *a1, const struct 
openvpn_sockaddr *a2)
 {
+    if (a1->addr.sa.sa_family != a2->addr.sa.sa_family)
+    {
+        return false;
+    }
     switch (a1->addr.sa.sa_family)
     {
         case AF_INET:

--
To view, visit https://gerrit.openvpn.net/c/openvpn/+/2327?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Idd4d71d02bafece74871a8b88b1c12d03d58540f
Gerrit-Change-Number: 2327
Gerrit-PatchSet: 2
Gerrit-Owner: Răzvan Cojocaru <[email protected]>
Gerrit-Reviewer: Arne Schwabe <[email protected]>
Gerrit-Reviewer: Frank Lichtenheld <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Reply via email to