From: Matt Corallo Date: Tue, 6 Feb 2024 17:50:47 +0000 (+0000) Subject: Correct length calculation when writing TXT records X-Git-Tag: v0.5.4~91 X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=38b9acc6f550f0e1ead8871d55d0186fcf3a10b4;p=dnssec-prover Correct length calculation when writing TXT records --- 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[..];