From ba070e7fdea30833057ed9630c8a259998fbb17e Mon Sep 17 00:00:00 2001 From: Marcin Siodelski Date: Wed, 21 Aug 2019 20:59:09 +0200 Subject: [PATCH] [#851,!24-p] Avoid accessing out of bound vector value in DUID factory. --- src/lib/dhcp/duid_factory.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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(), -- 2.47.2