Open thenewwazoo opened 3 years ago
Ah, I see. Good find. Wanna PR a fix?
I’ve gotten started but the encodeLength method is called in several places and I need to be confident I’m not going to break anything and that the tests are correct (plus it’s slow going since I’m not very familiar with JS :) ).
When a question's name field has a trailing dot (e.g.
1.0.0.127.in-addr.arpa.
), the length is computed before the trailing dot is dropped. This results in a buffer that's one byte longer than necessary, and which has a trailing byte that goes unfilled. For example,results in a buffer len of 56, but only 55 bytes are written.
The relevant code is here:
This was discovered while diagnosing #52 (also trying to diagnose https://github.com/mafintosh/multicast-dns/issues/13).
As a workaround, manually dropping the trailing dot in constructing the address seems to work (but not to fix my issue, oh well.)