Closed mh-cbon closed 8 years ago
Bonjour uses DNS-Based Service Discovery which dictates certain rules about the format of the TXT record. One of which says that:
The format of the data within a DNS TXT record is one or more strings, packed together in memory without any intervening gaps or padding bytes for word alignment.
And then goes on to add:
The format of each constituent string within the DNS TXT record is a single length byte, followed by 0-255 bytes of text data.
So since only a single byte is used to hold the length of the string, the string it self can't be more than 255 bytes. So if you try to parse a TXT record that doesn't follow these rules, the result is unpredictable.
The entire TXT record can't be more than 65,535 bytes totally.
This module uses dns-txt to encode and decode TXT records. I've just added a test to the module to show that decoding works just up to the limit of 255, but breaks after that: https://github.com/watson/dns-txt/commit/ed0e92389b70e715bec9e45ff83c487cff21c089
got it, thanks!
Hi,
I just tried to use the txt records to share a PGP public key.
It all gone very bad.
The packets received was malformed, see (i will deliberately put \n for readability)
announce sent
announce received
As you can see the txt record is kind of weird. Also i notice it s missing the very first character.
Maybe it s only my router. I m unsure where that come from.