]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[master] Fixed the 2 bugs found by the Visual Studio runtime + one by Stephen in...
authorFrancis Dupont <fdupont@isc.org>
Wed, 20 May 2015 14:02:16 +0000 (16:02 +0200)
committerFrancis Dupont <fdupont@isc.org>
Wed, 20 May 2015 14:02:16 +0000 (16:02 +0200)
ChangeLog
src/bin/dhcp4/tests/dhcp4_srv_unittest.cc
src/bin/perfdhcp/test_control.cc
src/bin/sockcreator/sockcreator.cc
src/bin/sockcreator/sockcreator.h
src/lib/dhcpsrv/lease_mgr_factory.h

index 3d58b979e71989bf25f4ccf3175f3ecd4620ec04..5815182d6c9411476f4548e47e9650c0d1b9ca4b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+936.   [bug]           fdupont
+       Added an ASSERT to avoid a crash in HooksDhcpv4SrvTest
+       subnet4SelectSimple unit test. Fixed out of bounds vector accesses
+       in perfdhcp (which should not be able to handle links
+       with long (i.e., more than 6 bytes) link-layer addresses).
+       (Trac #3868, git xxx)
+
 935.   [bug]           fdupont
        Fixed 3 out of bounds accesses on vectors in DHCP++ code.
        (Trac #3854, git de263ad0008f3494a85592f78db1ec662b68e689)
index f25a396d980894d02c31011deea23e30e99d7d1c..bb867ea22648ba03eb0153059edc0cb56aecdae8 100644 (file)
@@ -2432,6 +2432,7 @@ TEST_F(HooksDhcpv4SrvTest, subnet4SelectSimple) {
 
     // Server is supposed to report two subnets
     ASSERT_EQ(exp_subnets->size(), callback_subnet4collection_->size());
+    ASSERT_GE(exp_subnets->size(), 2);
 
     // Compare that the available subnets are reported as expected
     EXPECT_TRUE((*exp_subnets)[0].get() == (*callback_subnet4collection_)[0].get());
index 1f4c5c76ad50e4a411d85237b7f1676e99303dc3..51cc07b13326a13986b206a0c5ba011c0c508d29 100644 (file)
@@ -1702,7 +1702,10 @@ TestControl::sendRequest4(const TestControlSocket& socket,
     HWAddrPtr hwaddr = offer_pkt4->getHWAddr();
     std::vector<uint8_t> mac_address(HW_ETHER_LEN, 0);
     uint8_t hw_len = hwaddr->hwaddr_.size();
-    memcpy(&mac_address[0], &hwaddr->hwaddr_[0], hw_len > 16 ? 16 : hw_len);
+    if (hw_len != 0) {
+        memcpy(&mac_address[0], &hwaddr->hwaddr_[0],
+               hw_len > HW_ETHER_LEN ? HW_ETHER_LEN : hw_len);
+    }
     pkt4->writeAt(rand_offset, mac_address.begin(), mac_address.end());
 
     // Set elapsed time.
index 167e3f0163f02bf3c35a2ecfb1bf1e40ff806c1d..80727b4cf974e0d78e7cb348132cf8590fb95228 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2011  Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2011, 2015  Internet Systems Consortium, Inc. ("ISC")
 //
 // Permission to use, copy, modify, and/or distribute this software for any
 // purpose with or without fee is hereby granted, provided that the above
index a05cf6af680b3d8f60d8d35555ce4b2cce9e1d22..f4d6425b25fd98ffcd9a5fe0ac4cc823326eb47d 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2011-2012  Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2011-2012, 2015  Internet Systems Consortium, Inc. ("ISC")
 //
 // Permission to use, copy, modify, and/or distribute this software for any
 // purpose with or without fee is hereby granted, provided that the above
index 9218cf5e0b6a602c2475294f4f2984e4ea08e01e..accf3f7c7d87e091a4c4ce7c96a4da74446f93be 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2012 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2012, 2015 Internet Systems Consortium, Inc. ("ISC")
 //
 // Permission to use, copy, modify, and/or distribute this software for any
 // purpose with or without fee is hereby granted, provided that the above