diff options
Diffstat (limited to 'src/lib/dhcp')
-rw-r--r-- | src/lib/dhcp/pkt.cc | 8 | ||||
-rw-r--r-- | src/lib/dhcp/pkt4.cc | 3 |
2 files changed, 6 insertions, 5 deletions
diff --git a/src/lib/dhcp/pkt.cc b/src/lib/dhcp/pkt.cc index 82e5319c39..dfd1f8aa33 100644 --- a/src/lib/dhcp/pkt.cc +++ b/src/lib/dhcp/pkt.cc @@ -48,8 +48,12 @@ Pkt::Pkt(const uint8_t* buf, uint32_t len, const isc::asiolink::IOAddress& local remote_port_(remote_port), buffer_out_(0) { - data_.resize(len); - if (len) { + + if (len != 0) { + if (buf == NULL) { + isc_throw(InvalidParameter, "data buffer passed to Pkt is NULL"); + } + data_.resize(len); memcpy(&data_[0], buf, len); } } diff --git a/src/lib/dhcp/pkt4.cc b/src/lib/dhcp/pkt4.cc index c56c166959..1a406f87c9 100644 --- a/src/lib/dhcp/pkt4.cc +++ b/src/lib/dhcp/pkt4.cc @@ -74,9 +74,6 @@ Pkt4::Pkt4(const uint8_t* data, size_t len) isc_throw(OutOfRange, "Truncated DHCPv4 packet (len=" << len << ") received, at least " << DHCPV4_PKT_HDR_LEN << " is expected."); - - } else if (data == NULL) { - isc_throw(InvalidParameter, "data buffer passed to Pkt4 is NULL"); } } |