From: Marcin Siodelski Date: Mon, 10 Dec 2012 17:32:42 +0000 (+0100) Subject: [2491] Use insert instead of memcpy to append to a vector. X-Git-Tag: bind10-1.0.0-beta-release~19^2~15^2~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=eb5b276de3dc4c556c818ebfab63a14bf2f562eb;p=thirdparty%2Fkea.git [2491] Use insert instead of memcpy to append to a vector. --- diff --git a/src/lib/dhcp/option_data_types.cc b/src/lib/dhcp/option_data_types.cc index a0e29aa042..ce6f8c2cb9 100644 --- a/src/lib/dhcp/option_data_types.cc +++ b/src/lib/dhcp/option_data_types.cc @@ -236,11 +236,9 @@ OptionDataTypeUtil::writeFqdn(const std::string& fqdn, isc::dns::Name name(fqdn); isc::dns::LabelSequence labels(name); if (labels.getDataLength() > 0) { - buf.resize(buf.size() + labels.getDataLength()); size_t read_len = 0; const uint8_t* data = labels.getData(&read_len); - memcpy(static_cast(&buf[buf.size() - read_len]), - data, read_len); + buf.insert(buf.end(), data, data + read_len); } } catch (const isc::Exception& ex) { isc_throw(BadDataTypeCast, ex.what());