Skip to content

fix several latent bugs across parsing, OOM handling, and option validation#234

Open
vixie wants to merge 2 commits into
masterfrom
initial_claude_zed
Open

fix several latent bugs across parsing, OOM handling, and option validation#234
vixie wants to merge 2 commits into
masterfrom
initial_claude_zed

Conversation

@vixie
Copy link
Copy Markdown
Collaborator

@vixie vixie commented May 9, 2026

(from claude via zed.)

asinfo.c: inet_pton() returns 0 (not -1) on malformed addresses; the old check let bogus rdata through with an uninitialized stack buffer. Also use the canonical h_errno for the existence probe and propagate res_ninit() failure instead of charging ahead.

dnsdbq.c: -O case in qparam_option() referred to optarg instead of its own arg parameter; harmless today but a footgun. wordexp() return is now checked before dereferencing we_wordv. Reject -p minimal -J at parse time -- ruminate_json() builds a query without a mode, which previously tripped abort() inside present_minimal_lookup().

netio.c: realloc() / asprintf() failure no longer slides into a NULL deref. The earlier asprintf cast turned a -1 return into SIZE_MAX and the realloc results were unchecked. Also handle fdopen() failure on the sort pipes.

pdns.c: tuple_make() now requires rrname/rrtype/rdata up front, instead of leaving NULL pointers for sortable_rdatum() and the sort-key fprintf() to dereference on malformed records.

time.c: avoid imaxabs(INTMAX_MIN) UB in the relative-time path.

tokstr.h: drop a duplicate prototype.

…dation

asinfo.c: inet_pton() returns 0 (not -1) on malformed addresses; the old
check let bogus rdata through with an uninitialized stack buffer. Also
use the canonical h_errno for the existence probe and propagate
res_ninit() failure instead of charging ahead.

dnsdbq.c: -O case in qparam_option() referred to optarg instead of its
own arg parameter; harmless today but a footgun. wordexp() return is now
checked before dereferencing we_wordv. Reject -p minimal -J at parse
time -- ruminate_json() builds a query without a mode, which previously
tripped abort() inside present_minimal_lookup().

netio.c: realloc() / asprintf() failure no longer slides into a NULL
deref. The earlier asprintf cast turned a -1 return into SIZE_MAX and
the realloc results were unchecked. Also handle fdopen() failure on the
sort pipes.

pdns.c: tuple_make() now requires rrname/rrtype/rdata up front, instead
of leaving NULL pointers for sortable_rdatum() and the sort-key
fprintf() to dereference on malformed records.

time.c: avoid imaxabs(INTMAX_MIN) UB in the relative-time path.

tokstr.h: drop a duplicate prototype.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants