]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Replace memcpy with std::append 14620/head
authorFred Morcos <fred.morcos@open-xchange.com>
Wed, 25 Sep 2024 12:18:10 +0000 (14:18 +0200)
committerFred Morcos <fred.morcos@open-xchange.com>
Wed, 25 Sep 2024 12:18:10 +0000 (14:18 +0200)
modules/lmdbbackend/lmdbbackend.cc

index 38533b159070bacabd7fc011dac05ada27bd9457..e632c88ed6504cd7db6730e0c824feaf7f20d8a1 100644 (file)
@@ -918,15 +918,15 @@ std::string serializeToBuffer(const LMDBBackend::LMDBResourceRecord& value)
   buffer.reserve(sizeof(len) + len + sizeof(value.ttl) + sizeof(value.auth) + sizeof(value.disabled) + sizeof(value.ordername));
 
   // Store the size of the resource record.
-  buffer.resize(sizeof(len));
-  std::memcpy(&buffer.at(0), &len, sizeof(len));
+  // NOLINTNEXTLINE.
+  buffer.assign((const char*)&len, sizeof(len));
 
   // Store the contents of the resource record.
   buffer += value.content;
 
   // The few other things.
-  buffer.resize(buffer.size() + sizeof(value.ttl));
-  std::memcpy(&buffer.at(sizeof(len) + len), &value.ttl, sizeof(value.ttl));
+  // NOLINTNEXTLINE.
+  buffer.append((const char*)&value.ttl, sizeof(value.ttl));
   buffer.append(1, (char)value.auth);
   buffer.append(1, (char)value.disabled);
   buffer.append(1, (char)value.ordername);