Dominik ca509cb611 dhcp-common: fix OOB reads in DHCPv6 option_string() decoders
Two decoders in option_string() read beyond the end of the supplied
option-value buffer when a malformed DHCPv6 option is received:

1. OT_RFC1035_NAME: after advancing i past the last label (i = l),
   val[i] was read at line 885 to decide whether to append a '.'.
   If the label ends exactly at opt_len, i == opt_len and val[i]
   is one byte past the option data.  Fixed by guarding with
   i < opt_len before the read.

2. OT_CSTRING: the loop opened with while(1) and called GETSHORT
   (a 2-byte read) before checking that two bytes remained, so a
   1- or 0-byte option value caused an immediate 1-byte OOB read.
   Additionally, if the length field exceeded the remaining option
   data the inner body-copy loop read past the end.  Fixed by
   changing the loop condition to while(i+2 <= opt_len) and adding
   a check that the body fits before copying.

Both reads land inside the received packet buffer (no crash), but
they allow a DHCPv6 client to cause dnsmasq to read unrelated packet
bytes and emit them in syslog output.

Security: OOB reads of up to option-length bytes from a
network-supplied DHCPv6 packet; reachable only with --log-dhcp
enabled; no memory corruption, crash, or sensitive data disclosure
beyond adjacent packet bytes.

Signed-off-by: Dominik <dl6er@dl6er.de>
2026-03-30 18:09:43 +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.2 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%