bind9/bin
Ondřej Surý f1ec5e1809 Process dig -x reverse octets iteratively
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
2026-04-30 14:02:02 +02:00
..
check Resolve ERR_MISSING_GLUE / ERR_EXTRA_AAAA value collision 2026-04-29 17:31:23 +02:00
confgen Size HMAC key generation buffers to the maximum block size 2026-04-29 19:21:20 +02:00
delv Skip detach when delv's client never created 2026-04-30 10:56:11 +02:00
dig Process dig -x reverse octets iteratively 2026-04-30 14:02:02 +02:00
dnssec Change NSEC3 and NSEC3PARAM struct fields to use isc_region_t 2026-04-02 16:53:18 +02:00
include Remove NZF support, make LMDB required for new zone storage 2026-03-18 11:02:33 +01:00
named Run conn_cleanup on isccc_cc_towire failure in control_respond 2026-04-30 06:47:39 +02:00
nsupdate nsupdate does not handle zero length RDATA well 2026-04-09 09:24:47 +10:00
plugins Apply the dns_rdataset_cleanup patch through the codebase 2025-12-17 15:19:55 +01:00
rndc Dump delegation database in 'rndc dumpdb' 2026-03-30 20:41:13 +02:00
tests Process dig -x reverse octets iteratively 2026-04-30 14:02:02 +02:00
tools Remove NZF support, make LMDB required for new zone storage 2026-03-18 11:02:33 +01:00
meson.build replace the build system with meson 2025-06-11 10:30:12 +03:00