diff options
author | jorton <jorton@13f79535-47bb-0310-9956-ffa450edef68> | 2012-11-05 22:07:51 +0000 |
---|---|---|
committer | jorton <jorton@13f79535-47bb-0310-9956-ffa450edef68> | 2012-11-05 22:07:51 +0000 |
commit | ecf9b21b1b2877a22dc06326ab39ed52574a6dfe (patch) | |
tree | 6c3654b713481c4d0ea6e4455845e38b60ea73f6 /network_io | |
parent | 919aa8b0d9bcd9dd955b15950fd6c4e033376f11 (diff) | |
download | libapr-ecf9b21b1b2877a22dc06326ab39ed52574a6dfe.tar.gz |
* network_io/unix/sockaddr.c (apr_ipsubnet_test): Fix false positive
when testing a v4 subnet against a v6 address.
* test/testipsub.c (test_interesting_subnets): Add test.
PR: 54047
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1405985 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'network_io')
-rw-r--r-- | network_io/unix/sockaddr.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/network_io/unix/sockaddr.c b/network_io/unix/sockaddr.c index e6c103531..9e98821ee 100644 --- a/network_io/unix/sockaddr.c +++ b/network_io/unix/sockaddr.c @@ -1068,7 +1068,7 @@ APR_DECLARE(int) apr_ipsubnet_test(apr_ipsubnet_t *ipsub, apr_sockaddr_t *sa) /* XXX This line will segv on Win32 build with APR_HAVE_IPV6, * but without the IPV6 drivers installed. */ - if (sa->sa.sin.sin_family == AF_INET) { + if (sa->family == AF_INET) { if (ipsub->family == AF_INET && ((sa->sa.sin.sin_addr.s_addr & ipsub->mask[0]) == ipsub->sub[0])) { return 1; @@ -1080,7 +1080,7 @@ APR_DECLARE(int) apr_ipsubnet_test(apr_ipsubnet_t *ipsub, apr_sockaddr_t *sa) return 1; } } - else { + else if (sa->family == AF_INET6 && ipsub->family == AF_INET6) { apr_uint32_t *addr = (apr_uint32_t *)sa->ipaddr_ptr; if ((addr[0] & ipsub->mask[0]) == ipsub->sub[0] && |