bind9/bin/dig
Ondřej Surý 0d0f69db89 Bound EDNS option length in dig's process_opt() walk
process_opt() reads the per-option (optcode, optlen) header from the
OPT rdata and then advances the buffer by optlen, both for the COOKIE
branch (via process_cookie()) and for any other optcode.  The walk
itself never compared optlen to the buffer remainder; the only reason
it cannot trip the isc_buffer_forward() REQUIRE today is that
fromwire_opt() (lib/dns/rdata/generic/opt_41.c) already validates each
option's length against the rdata bounds before the rdataset is
handed back, so process_opt() never sees a self-inconsistent rdata.

That upstream guarantee is fine, but it leaves the local walker
trusting an invariant established elsewhere.  Add a defensive check
that just stops the walk when a future caller (a cached message, an
alternate parser, a refactor of the OPT validator) hands process_opt()
a buffer where optlen would run past the end.

Assisted-by: Claude:claude-opus-4-7
2026-05-01 07:19:49 +02:00
..
.gitignore [master] update gitignore files; use rev-parse to get srcid 2014-06-17 13:49:30 -07:00
dig.c switch to RETERR where it wasn't being used 2025-12-03 13:45:43 -08:00
dig.rst Add examples to the dig man page 2026-02-22 11:03:10 -05:00
dighost.c Bound EDNS option length in dig's process_opt() walk 2026-05-01 07:19:49 +02:00
dighost.h Add +[no]showtruncated to dig 2025-12-02 09:34:13 +11:00
host.c switch to RETERR where it wasn't being used 2025-12-03 13:45:43 -08:00
host.rst Do HTTPS record query from host in addition 2025-02-18 14:56:08 +00:00
meson.build replace the build system with meson 2025-06-11 10:30:12 +03:00
nslookup.c add dns_message API to add EDNS options 2025-11-21 11:13:18 -08:00
nslookup.rst Add internal hyperlinks to See Also section of manual pages 2022-03-14 10:46:36 +01:00