From: Fred Morcos Date: Tue, 24 Sep 2024 12:04:16 +0000 (+0200) Subject: Fix new impl of serializeToBuffer X-Git-Tag: rec-5.2.0-alpha1~61^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1c88c99cb1c4ac956d344734b229918988cfcab6;p=thirdparty%2Fpdns.git Fix new impl of serializeToBuffer --- diff --git a/modules/lmdbbackend/lmdbbackend.cc b/modules/lmdbbackend/lmdbbackend.cc index 3482256f63..38533b1590 100644 --- a/modules/lmdbbackend/lmdbbackend.cc +++ b/modules/lmdbbackend/lmdbbackend.cc @@ -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);