Browse Source

[master] Fixed the 2 bugs found by the Visual Studio runtime + one by Stephen in src/bin

Francis Dupont 10 years ago
parent
commit
c20f47e19d

+ 7 - 0
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
 935.	[bug]		fdupont
 	Fixed 3 out of bounds accesses on vectors in DHCP++ code.
 	Fixed 3 out of bounds accesses on vectors in DHCP++ code.
 	(Trac #3854, git de263ad0008f3494a85592f78db1ec662b68e689)
 	(Trac #3854, git de263ad0008f3494a85592f78db1ec662b68e689)

+ 1 - 0
src/bin/dhcp4/tests/dhcp4_srv_unittest.cc

@@ -2432,6 +2432,7 @@ TEST_F(HooksDhcpv4SrvTest, subnet4SelectSimple) {
 
 
     // Server is supposed to report two subnets
     // Server is supposed to report two subnets
     ASSERT_EQ(exp_subnets->size(), callback_subnet4collection_->size());
     ASSERT_EQ(exp_subnets->size(), callback_subnet4collection_->size());
+    ASSERT_GE(exp_subnets->size(), 2);
 
 
     // Compare that the available subnets are reported as expected
     // Compare that the available subnets are reported as expected
     EXPECT_TRUE((*exp_subnets)[0].get() == (*callback_subnet4collection_)[0].get());
     EXPECT_TRUE((*exp_subnets)[0].get() == (*callback_subnet4collection_)[0].get());

+ 4 - 1
src/bin/perfdhcp/test_control.cc

@@ -1702,7 +1702,10 @@ TestControl::sendRequest4(const TestControlSocket& socket,
     HWAddrPtr hwaddr = offer_pkt4->getHWAddr();
     HWAddrPtr hwaddr = offer_pkt4->getHWAddr();
     std::vector<uint8_t> mac_address(HW_ETHER_LEN, 0);
     std::vector<uint8_t> mac_address(HW_ETHER_LEN, 0);
     uint8_t hw_len = hwaddr->hwaddr_.size();
     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());
     pkt4->writeAt(rand_offset, mac_address.begin(), mac_address.end());
 
 
     // Set elapsed time.
     // Set elapsed time.

+ 1 - 1
src/bin/sockcreator/sockcreator.cc

@@ -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
 // Permission to use, copy, modify, and/or distribute this software for any
 // purpose with or without fee is hereby granted, provided that the above
 // purpose with or without fee is hereby granted, provided that the above

+ 1 - 1
src/bin/sockcreator/sockcreator.h

@@ -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
 // Permission to use, copy, modify, and/or distribute this software for any
 // purpose with or without fee is hereby granted, provided that the above
 // purpose with or without fee is hereby granted, provided that the above

+ 1 - 1
src/lib/dhcpsrv/lease_mgr_factory.h

@@ -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
 // Permission to use, copy, modify, and/or distribute this software for any
 // purpose with or without fee is hereby granted, provided that the above
 // purpose with or without fee is hereby granted, provided that the above