]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Fix new impl of serializeToBuffer
authorFred Morcos <fred.morcos@open-xchange.com>
Tue, 24 Sep 2024 12:04:16 +0000 (14:04 +0200)
committerFred Morcos <fred.morcos@open-xchange.com>
Tue, 24 Sep 2024 12:04:16 +0000 (14:04 +0200)
modules/lmdbbackend/lmdbbackend.cc

index 3482256f6381f28c5a7eb62028dd84d86033b73a..38533b159070bacabd7fc011dac05ada27bd9457 100644 (file)
@@ -918,12 +918,14 @@ 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));
 
   // 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));
   buffer.append(1, (char)value.auth);
   buffer.append(1, (char)value.disabled);