dhcpv6-ia: fix a crash when static lease isn't configured
authorDavid Härdeman <[email protected]>
Thu, 27 Nov 2025 23:30:59 +0000 (00:30 +0100)
committerÁlvaro Fernández Rojas <[email protected]>
Fri, 28 Nov 2025 07:07:27 +0000 (08:07 +0100)
commit7336992e68663ea2779cd3c9d9e67e76aed80fcd
tree782c3c05003b4abd72d292e46263d5a34e78fcf2
parent338ca8abb950e4e0448a13d50d6d6567a167d016
dhcpv6-ia: fix a crash when static lease isn't configured

Quoting from https://github.com/openwrt/odhcpd/issues/321:
  [71802.880039] odhcpd[22696]: segfault at 78...

Quoting from https://forum.openwrt.org/t/odhcpd-crash-loop-when-receiving-packet/243015/69:
  [   77.761062] odhcpd[2075]: segfault at 78...

0x78 is the offset of duid_count in struct lease_cfg, so if lease_cfg is
null, we'd end up reading from address 0x78 when trying to read
lease_cfg->duid_count.

This should fix the issue. Thanks to @klipz in the forums for giving me
SSH access to an awesome test sandbox.

Closes: https://github.com/openwrt/odhcpd/issues/321
Signed-off-by: David Härdeman <[email protected]>
Link: https://github.com/openwrt/odhcpd/pull/328
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
src/dhcpv6-ia.c