From 38b9acc6f550f0e1ead8871d55d0186fcf3a10b4 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Tue, 6 Feb 2024 17:50:47 +0000 Subject: [PATCH] Correct length calculation when writing TXT records --- src/rr.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rr.rs b/src/rr.rs index 3d1a6a8..14826e3 100644 --- a/src/rr.rs +++ b/src/rr.rs @@ -189,7 +189,7 @@ impl StaticRecord for Txt { Ok(Txt { name, data: parsed_data }) } fn write_u16_len_prefixed_data(&self, out: &mut Vec) { - let len = (self.data.len() + self.data.len() / 255 + 1) as u16; + let len = (self.data.len() + (self.data.len() + 254) / 255) as u16; out.extend_from_slice(&len.to_be_bytes()); let mut data_write = &self.data[..]; -- 2.39.5