]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#722,!3-p] Addressed review comment
authorThomas Markwalder <tmark@isc.org>
Wed, 14 Aug 2019 15:50:19 +0000 (11:50 -0400)
committerThomas Markwalder <tmark@isc.org>
Wed, 14 Aug 2019 16:01:10 +0000 (12:01 -0400)
src/bin/dhcp6/dhcp6_srv.cc
    Dhcp6Srv::sanityCheckDuid() - reworked sanity check logic

src/bin/dhcp6/dhcp6_srv.cc

index 48ab4d8986af7c1c1e445ab8c636b8061effd8de..6a58d6aa13ffab6449537a76410a13bc67c42ce9 100644 (file)
@@ -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);
     }
 }