[PR #2780] [MERGED] Preserve fully qualified status of Name after prepend_label #3312

Closed
opened 2026-03-16 11:36:51 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/hickory-dns/hickory-dns/pull/2780
Author: @dead10ck
Created: 2/14/2025
Status: Merged
Merged: 2/16/2025
Merged by: @djc

Base: mainHead: fix/name-prepend-label


📝 Commits (2)

  • 3c1075d make Name::prepend_label preserve fqdn
  • 032cf54 check length violation before mutation

📊 Changes

1 file changed (+50 additions, -3 deletions)

View changed files

📝 crates/proto/src/rr/domain/name.rs (+50 -3)

📄 Description

make Name::prepend_label preserve fqdn

Currently, if you have a fully qualified Name and you add a label with prepend_label, the resulting Name is not fully qualified. This change modifies the behavior so that if the fully qualified marker of the input Name is the same in the new Name.

check length violation before mutation

Currently, when appending a label to a name, the label is appended first, and then the length of the buffer is checked. This returns an error, but still leaves the buffer in an illegal state, potentially allowing further use if the Name is not disregarded after this point.

Instead the new length is checked before mutating the buffer, leaving it unmodified if the result would be too long.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/hickory-dns/hickory-dns/pull/2780 **Author:** [@dead10ck](https://github.com/dead10ck) **Created:** 2/14/2025 **Status:** ✅ Merged **Merged:** 2/16/2025 **Merged by:** [@djc](https://github.com/djc) **Base:** `main` ← **Head:** `fix/name-prepend-label` --- ### 📝 Commits (2) - [`3c1075d`](https://github.com/hickory-dns/hickory-dns/commit/3c1075d9e9426954ce8f495e6991e31b59d1e5d4) make Name::prepend_label preserve fqdn - [`032cf54`](https://github.com/hickory-dns/hickory-dns/commit/032cf54c1650be62caa29d2229b6e73a0cb0adb6) check length violation before mutation ### 📊 Changes **1 file changed** (+50 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `crates/proto/src/rr/domain/name.rs` (+50 -3) </details> ### 📄 Description **make Name::prepend_label preserve fqdn** Currently, if you have a fully qualified `Name` and you add a label with `prepend_label`, the resulting `Name` is not fully qualified. This change modifies the behavior so that if the fully qualified marker of the input `Name` is the same in the new `Name`. **check length violation before mutation** Currently, when appending a label to a name, the label is appended first, and then the length of the buffer is checked. This returns an error, but still leaves the buffer in an illegal state, potentially allowing further use if the Name is not disregarded after this point. Instead the new length is checked before mutating the buffer, leaving it unmodified if the result would be too long. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-16 11:36:51 +03:00
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#3312
No description provided.