Commit c20f47e1 authored by Francis Dupont's avatar Francis Dupont
Browse files

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

parent d3571759
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)
......
...@@ -2432,6 +2432,7 @@ TEST_F(HooksDhcpv4SrvTest, subnet4SelectSimple) { ...@@ -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());
......
...@@ -1702,7 +1702,10 @@ TestControl::sendRequest4(const TestControlSocket& socket, ...@@ -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.
......
// 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
......
// 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
......
// 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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment