[GH-ISSUE #319] Incorrect truncation #145

Closed
opened 2026-03-07 22:27:53 +03:00 by kerem · 1 comment
Owner

Originally created by @vorner on GitHub (Dec 17, 2017).
Original GitHub issue: https://github.com/hickory-dns/hickory-dns/issues/319

This seems to be wrong: https://docs.rs/trust-dns/0.13.0/trust_dns/op/struct.Message.html#method.truncate. I haven't read the RFCs in a while, so I don't remember which one it was, but as I remember, the idea with truncation was to put as much as fits into the message (depending on the size of the buffer).

AFAIK it is usually done during writing of the message to the output buffer ‒ it is being written from the beginning and if something doesn't fit, it returns back and flips the bit.

Originally created by @vorner on GitHub (Dec 17, 2017). Original GitHub issue: https://github.com/hickory-dns/hickory-dns/issues/319 This seems to be wrong: https://docs.rs/trust-dns/0.13.0/trust_dns/op/struct.Message.html#method.truncate. I haven't read the RFCs in a while, so I don't remember which one it was, but as I remember, the idea with truncation was to put as much as fits into the message (depending on the size of the buffer). AFAIK it is usually done during writing of the message to the output buffer ‒ it is being written from the beginning and if something doesn't fit, it returns back and flips the bit.
kerem 2026-03-07 22:27:53 +03:00
Author
Owner

@bluejekyll commented on GitHub (Dec 17, 2017):

Yes, we could definitely be a little less aggressive on the truncation. I think the size of the output buffer should respect EDNS. After that, we can then implement what you suggest. It will require some trimming of the outbound buffer. I have some new methods coming on BinEncoder that should make this easier.

<!-- gh-comment-id:352288644 --> @bluejekyll commented on GitHub (Dec 17, 2017): Yes, we could definitely be a little less aggressive on the truncation. I think the size of the output buffer should respect EDNS. After that, we can then implement what you suggest. It will require some trimming of the outbound buffer. I have some new methods coming on BinEncoder that should make this easier.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hickory-dns#145
No description provided.