Attention is currently required from: Arne Schwabe.

Hello Arne Schwabe,

I'd like you to do a code review.
Please visit

    https://gerrit.openvpn.net/c/openvpn/+/2215?usp=email

to review the following change.


Change subject: socket_util: check the address family in addrlist_match()
......................................................................

socket_util: check the address family in addrlist_match()

addrlist_match() cast each remote list entry to the peer's address
family without checking ai_family. With a dual-stack remote list, an
IPv6 peer compared against an IPv4 entry read past the end of its
sockaddr_in, and 0.0.0.0 matched any IPv6 entry. Skip entries of the
other family, as addrlist_port_match() already does.

Change-Id: Ic3efcdb7bc4e60a81b9292adfe7f8e22b86e274a
Signed-off-by: Razvan Cojocaru <[email protected]>
---
M src/openvpn/socket_util.h
1 file changed, 6 insertions(+), 4 deletions(-)



  git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/15/2215/1

diff --git a/src/openvpn/socket_util.h b/src/openvpn/socket_util.h
index a1a61af..012bded 100644
--- a/src/openvpn/socket_util.h
+++ b/src/openvpn/socket_util.h
@@ -315,16 +315,18 @@
         switch (a1->addr.sa.sa_family)
         {
             case AF_INET:
-                if (a1->addr.in4.sin_addr.s_addr
-                    == ((struct sockaddr_in 
*)curele->ai_addr)->sin_addr.s_addr)
+                if (curele->ai_family == AF_INET
+                    && a1->addr.in4.sin_addr.s_addr
+                           == ((struct sockaddr_in 
*)curele->ai_addr)->sin_addr.s_addr)
                 {
                     return true;
                 }
                 break;

             case AF_INET6:
-                if (IN6_ARE_ADDR_EQUAL(&a1->addr.in6.sin6_addr,
-                                       &((struct sockaddr_in6 
*)curele->ai_addr)->sin6_addr))
+                if (curele->ai_family == AF_INET6
+                    && IN6_ARE_ADDR_EQUAL(&a1->addr.in6.sin6_addr,
+                                          &((struct sockaddr_in6 
*)curele->ai_addr)->sin6_addr))
                 {
                     return true;
                 }

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

Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ic3efcdb7bc4e60a81b9292adfe7f8e22b86e274a
Gerrit-Change-Number: 2215
Gerrit-PatchSet: 1
Gerrit-Owner: Răzvan Cojocaru <[email protected]>
Gerrit-Reviewer: Arne Schwabe <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: Arne Schwabe <[email protected]>
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Reply via email to