From: Thomas Markwalder Date: Wed, 14 Aug 2019 15:50:19 +0000 (-0400) Subject: [#722,!3-p] Addressed review comment X-Git-Tag: Kea-1.5.0-P1~18 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=deda53e55c8afdd230ee05597c0377d6dacfefe7;p=thirdparty%2Fkea.git [#722,!3-p] Addressed review comment src/bin/dhcp6/dhcp6_srv.cc Dhcp6Srv::sanityCheckDuid() - reworked sanity check logic --- diff --git a/src/bin/dhcp6/dhcp6_srv.cc b/src/bin/dhcp6/dhcp6_srv.cc index 48ab4d8986..6a58d6aa13 100644 --- a/src/bin/dhcp6/dhcp6_srv.cc +++ b/src/bin/dhcp6/dhcp6_srv.cc @@ -1353,9 +1353,10 @@ void Dhcpv6Srv::sanityCheckDUID(const OptionPtr& opt, const std::string& opt_nam // The client-id or server-id has to have at least 3 bytes of useful data: // two for duid type and one more for actual duid value. uint16_t len = opt->len() - opt->getHeaderLen(); - if ( (len < 3) || (len > DUID::MAX_DUID_LEN) ) { - isc_throw(RFCViolation, "Received " << opt_name << " option with invalid length: " - << len << ", expected 3..128."); + if (len < 3 || len > DUID::MAX_DUID_LEN || opt->getData().empty()) { + isc_throw(RFCViolation, "Received invalid DUID for " << opt_name << ", received " + << len << " byte(s). It must be at least 3 and no more than " + << DUID::MAX_DUID_LEN); } }