mirror of
https://github.com/isc-projects/bind9.git
synced 2026-06-10 12:20:00 -04:00
reverse_octets() recursed once per dot, with depth bounded only by ARG_MAX (~2 MiB on Linux), so feeding dig -x a deep input like '1.1.1.…1' busted the call stack and crashed the tool with SIGSEGV instead of a structured error. The transformation it performs is purely textual (split on '.', emit components in reverse), so the recursion was never load-bearing. Walk the input once into a fixed-size array of label slices, capped at DNS_NAME_MAXLABELS (which is the most we could ever fit into the result buffer anyway), then iterate the array in reverse to write the output. Inputs with more than DNS_NAME_MAXLABELS labels now return DNS_R_NAMETOOLONG, which dig.c surfaces as 'Invalid IP address' and exit 1. Drop the unnecessary (int) casts on ptrdiff_t/size_t lengths while at it. Assisted-by: Claude:claude-opus-4-7 |
||
|---|---|---|
| .. | ||
| ans4 | ||
| ans5 | ||
| ans6 | ||
| ans7 | ||
| ns1 | ||
| ns2 | ||
| ns3 | ||
| prereq.sh | ||
| root.hint | ||
| setup.sh | ||
| tests.sh | ||
| tests_sh_digdelv.py | ||
| yamlget.py | ||