From: Razvan Cojocaru <[email protected]>

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
---

This change was reviewed on Gerrit and approved by at least one
developer. I request to merge it to master.

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/2327
This mail reflects revision 1 of this Change.

Acked-by according to Gerrit (reflected above):
Frank Lichtenheld <[email protected]>

        
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:


_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Reply via email to