DominikandClaude Sonnet 4.6 cd04c0ce20 lease: check parse_hex() return value before use as length
parse_hex() returns -1 on malformed input.  Three call sites in
read_leases() used the return value directly as a length argument
without checking for the error sentinel:

  opt_len  → lease_set_vendorclass() / lease_set_agent_id()
              whine_malloc(-1) attempts a ~4 GB allocation, likely
              crashing the process.

  hw_len   → lease_set_hwaddr()
              memcpy(lease->hwaddr, hwaddr, (size_t)-1) performs an
              ~18 EB write, causing an immediate crash.

  clid_len → lease_set_hwaddr() (same path as hw_len)

Exploitation requires a corrupted or attacker-controlled lease file;
it is not directly network-triggerable.  However, any process that can
write to the lease file (e.g. a compromised helper) can crash or
potentially gain code execution in the dnsmasq process at next startup
or lease-file re-read.

Fix: mirror the existing duid path (which already guards its
parse_hex call) by checking for < 0.  For opt_len, skip the record
(continue) to match the "invalid line" behaviour.  For hw_len and
clid_len, treat the failure as a zero-length field so the lease is
still created with the correct address.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-30 20:06:34 +01:00
2012-04-02 20:40:34 +01:00
2025-12-07 13:44:40 +00:00
2012-01-05 17:31:15 +00:00
2018-01-14 17:32:52 +00:00
2022-05-13 21:22:11 +01:00
2012-01-05 17:31:13 +00:00
2025-07-20 15:29:43 +01:00
2021-06-15 23:14:59 +01:00
2025-01-23 17:08:39 +00:00
2025-07-20 15:29:43 +01:00
2024-12-18 23:58:58 +00:00
2012-01-05 22:00:08 +00:00
S
Description
No description provided
GPL-2.0
6.3 MiB
0 Stars 1 Watchers 0 Forks
Languages
C 94.3%
Perl 2.2%
HTML 1.2%
Shell 1%
Makefile 0.6%
Other 0.6%