]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[5449] Fixes from address sanitizer run on last macOS/Xcode
authorFrancis Dupont <fdupont@isc.org>
Sat, 9 Dec 2017 09:15:38 +0000 (10:15 +0100)
committerFrancis Dupont <fdupont@isc.org>
Sat, 9 Dec 2017 09:15:38 +0000 (10:15 +0100)
src/bin/dhcp6/tests/decline_unittest.cc
src/lib/cryptolink/openssl_common.h

index 7abd22c7fdd17d512d6662e2d8b1f7613c3969c4..53be0f515a4f5f31170f32fae1572bf1f53ea4e8 100644 (file)
@@ -142,8 +142,11 @@ Dhcpv6SrvTest::acquireAndDecline(Dhcp6Client& client,
     // Use the second duid
     client.setDUID(duid2);
 
-    // Use the second IAID
-    client.config_.leases_[0].iaid_ = iaid2;
+    // Use the second IAID (but not in NO_IA which has cleared leases)
+    if (addr_type != NO_IA) {
+        ASSERT_NE(0, client.config_.leases_.size());
+        client.config_.leases_[0].iaid_ = iaid2;
+    }
 
     // Ok, let's decline the lease.
     ASSERT_NO_THROW(client.doDecline(include_address_));
index 403a59d3b2d2e454fb5856d745ba1a18ea357fe4..6011f7e6c808626fea46cb0e4f3bfdaeca3f4f59 100644 (file)
@@ -37,6 +37,10 @@ public:
     SecBuf(const std::vector<T>& x) : vec_(x) {}
 
     ~SecBuf() {
+#if defined(__has_feature) && __has_feature(address_sanitizer)
+        // Make the address sanitizer happy assuming this won't reallocate
+        vec_.resize(vec_.capacity());
+#endif
         std::memset(&vec_[0], 0, vec_.capacity() * sizeof(T));
     };
 
@@ -65,6 +69,10 @@ public:
     };
 
     void clear() {
+#if defined(__has_feature) && __has_feature(address_sanitizer)
+        // Make the address sanitizer happy assuming this won't reallocate
+        vec_.resize(vec_.capacity());
+#endif
         std::memset(&vec_[0], 0, vec_.capacity() * sizeof(T));
         vec_.clear();
     }