DNS message encoding and decoding for Zig, with no I/O and no allocation.
zig-dns docs adr 0002-refuse-pointer-chains.md
1.4 kB · 28 lines
Markdown
at main

Refuse pointer chains and overlapping targets instead of counting jumps #

A compression pointer is refused as BadPointer, under both pointer rules, when its target is another compression pointer or when the name it leads to does not end before the part of the name holding the pointer began. Without the first, a name could follow about eight thousand pointers in a row without adding a byte to its expanded length, and every record naming it would repeat the walk. Once each pointer is followed by at least one label, the 255-byte limit on a name also limits the jumps to about 128, so no separate count is needed. The second is what RFC 1035's "a prior occurrence of the same name" says when it is read as wholly prior: a target that runs on over the pointer itself is not an occurrence of anything.

Nothing that compresses a name produces either, so both turn away only messages that nothing generated.

Considered Options #

dnspython 2.9.0 (GHSA-45c3-73f7-pv4m) instead stops after 16 jumps. That number is arbitrary: a name with seventeen labels, each one compressed against a different earlier name, is legitimate and would be refused. It is recorded in tests/differential.py as a deliberate difference. dnspython 2.9.1 refuses overlapping targets as well, which this matches.