]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Do not serialize records over 64K in length. 17447/head
authorMiod Vallat <miod.vallat@powerdns.com>
Mon, 18 May 2026 14:19:49 +0000 (16:19 +0200)
committerMiod Vallat <miod.vallat@powerdns.com>
Mon, 18 May 2026 14:19:49 +0000 (16:19 +0200)
Signed-off-by: Miod Vallat <miod.vallat@powerdns.com>
modules/lmdbbackend/lmdbbackend.cc

index 1051c998afaa94e36fa3e7bc014b6a7d8c5a28b5..5611aec2fcf09376182d67379a570e7fb204618c 100644 (file)
@@ -1085,6 +1085,10 @@ constexpr size_t serialize_offset_ordername = serialize_offset_disabled + sizeof
 template <>
 void serializeToBuffer(std::string& buffer, const LMDBBackend::LMDBResourceRecord& value)
 {
+  if (value.content.length() > std::numeric_limits<uint16_t>::max()) {
+    throw PDNSException("DNS record is too large (" + std::to_string(value.content.length()) + "), unable to serialize in LMDB");
+  }
+
   // Data size of the resource record.
   uint16_t len = value.content.length();