Skip to content

fix: TXT decode preserves string-boundary info#125

Open
msimerson wants to merge 1 commit into
lsongdev:masterfrom
NicTool:h6-txt-as-array
Open

fix: TXT decode preserves string-boundary info#125
msimerson wants to merge 1 commit into
lsongdev:masterfrom
NicTool:h6-txt-as-array

Conversation

@msimerson
Copy link
Copy Markdown
Collaborator

@msimerson msimerson commented May 26, 2026

RFC 1035 §3.3.14

A TXT RDATA can contain multiple <character-string> items, each length-prefixed. Packet.Resource.TXT.decode (packet.js:618–633) concatenates all strings into a single this.data value, discarding the boundaries. Applications that rely on multi-string TXT records (SPF, DKIM) will receive incorrect data.

The encoder handles arrays correctly; the asymmetry means decode→encode is lossy.

PS: it was back around node.js 0.11 or so when c-ares had this exact same issue, and had to resolve it this same way. It affected us over in Haraka, a SMTP daemon, where we consume a lot of SPF and DKIM records.

@lsongdev lsongdev marked this pull request as ready for review May 26, 2026 13:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant