diff options
author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2019-06-13 12:52:38 -0700 |
---|---|---|
committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2019-06-13 12:52:38 -0700 |
commit | ce2338c24a46558a2e0fdb7ebbcf2e6ce9c8b615 (patch) | |
tree | adbea234d29e2c8ecb49b571748a1b41fd6bffe2 | |
parent | 5b2b0887141da25c290608632c2e609764abbf73 (diff) | |
download | infinitytier-ce2338c24a46558a2e0fdb7ebbcf2e6ce9c8b615.tar.gz infinitytier-ce2338c24a46558a2e0fdb7ebbcf2e6ce9c8b615.zip |
Fix null ptr on managed routes if no IPs are set.
-rw-r--r-- | service/OneService.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/service/OneService.cpp b/service/OneService.cpp index 17f7debc..b3d6739a 100644 --- a/service/OneService.cpp +++ b/service/OneService.cpp @@ -190,6 +190,8 @@ namespace ZeroTier { namespace { +static const InetAddress NULL_INET_ADDR; + // Fake TLS hello for TCP tunnel outgoing connections (TUNNELED mode) static const char ZT_TCP_TUNNEL_HELLO[9] = { 0x17,0x03,0x03,0x00,0x04,(char)ZEROTIER_ONE_VERSION_MAJOR,(char)ZEROTIER_ONE_VERSION_MINOR,(char)((ZEROTIER_ONE_VERSION_REVISION >> 8) & 0xff),(char)(ZEROTIER_ONE_VERSION_REVISION & 0xff) }; @@ -1855,7 +1857,7 @@ public: const InetAddress *const target = reinterpret_cast<const InetAddress *>(&(n.config.routes[i].target)); const InetAddress *const via = reinterpret_cast<const InetAddress *>(&(n.config.routes[i].via)); - InetAddress *src = NULL; + const InetAddress *src = NULL; for (unsigned int j=0; j<n.config.assignedAddressCount; ++j) { const InetAddress *const tmp = reinterpret_cast<const InetAddress *>(&(n.config.assignedAddresses[j])); if (target->isV4() && tmp->isV4()) { @@ -1866,6 +1868,8 @@ public: break; } } + if (!src) + src = &NULL_INET_ADDR; if ( (!checkIfManagedIsAllowed(n,*target)) || ((via->ss_family == target->ss_family)&&(matchIpOnly(myIps,*via))) ) continue; |