From: Marcin Siodelski Date: Wed, 21 Aug 2019 18:59:09 +0000 (+0200) Subject: [#851,!24-p] Avoid accessing out of bound vector value in DUID factory. X-Git-Tag: Kea-1.6.0~20 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ba070e7fdea30833057ed9630c8a259998fbb17e;p=thirdparty%2Fkea.git [#851,!24-p] Avoid accessing out of bound vector value in DUID factory. --- diff --git a/src/lib/dhcp/duid_factory.cc b/src/lib/dhcp/duid_factory.cc index a751f9b252..6cbeebe6ea 100644 --- a/src/lib/dhcp/duid_factory.cc +++ b/src/lib/dhcp/duid_factory.cc @@ -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(),