]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#851,!24-p] Avoid accessing out of bound vector value in DUID factory.
authorMarcin Siodelski <marcin@isc.org>
Wed, 21 Aug 2019 18:59:09 +0000 (20:59 +0200)
committerMarcin Siodelski <marcin@isc.org>
Wed, 21 Aug 2019 18:59:09 +0000 (20:59 +0200)
src/lib/dhcp/duid_factory.cc

index a751f9b2527000e9bdc3c545d971dd7df961b9d4..6cbeebe6ea83d141f9298eed8b21209d247d1767 100644 (file)
@@ -167,9 +167,9 @@ DUIDFactory::createEN(const uint32_t enterprise_id,
             // Variable length identifier consists of random numbers. The generated
             // identifier is always 6 bytes long.
             ::srandom(time(NULL));
-            fillRandom(&duid_out[DUID_TYPE_LEN + ENTERPRISE_ID_LEN],
-                       &duid_out[DUID_TYPE_LEN + ENTERPRISE_ID_LEN +
-                                 DUID_EN_IDENTIFIER_LEN]);
+            fillRandom(duid_out.begin() + DUID_TYPE_LEN + ENTERPRISE_ID_LEN,
+                       duid_out.end());
+
         } else {
             // Append existing identifier.
             duid_out.insert(duid_out.end(), identifier_current.begin(),