Skip to content

iface: bound the subscriber table - #556

Open
TurkeyMan wants to merge 1 commit into
masterfrom
agent/iface-subscriber-bounds
Open

iface: bound the subscriber table#556
TurkeyMan wants to merge 1 commit into
masterfrom
agent/iface-subscriber-bounds

Conversation

@TurkeyMan

Copy link
Copy Markdown
Member

subscribe() wrote _subscribers[_num_subscribers++] into a fixed InterfaceSubscriber[4] with no capacity check. Release builds carry no bounds check, so the fifth subscriber silently overwrote whatever sits behind the array.

Found on hardware. An ESP32-S3 whose peering session had spawned a few dynamic peers went into a very specific half-dead state: it kept beaconing, kept answering OpenWatt identify sweeps, kept answering ARP - and stopped delivering IPv4 entirely, so ICMP, telnet and HTTP were all gone. It needed a power cycle. Same class as the /device/print --json heap corruption seen on the Pi.

Refuse past capacity and log it, so the failure is a visible refusal instead of silent corruption. Eight slots rather than four: a station carrying the IP stack, an ether tap, a discovery domain and a peering session is already at four before anything dynamic attaches.

Verified on hardware: with this in, the same S3 survived two full claim storms that previously took it off IP, staying reachable throughout. The guard itself never fired at eight slots, so the overflow was landing just past four. 139/139 modules pass; aarch64, xtensa and windows all build clean.

🤖 Generated with Claude Code

subscribe() wrote _subscribers[_num_subscribers++] into a fixed four-slot
array with no capacity check. Release builds carry no bounds check, so the
fifth subscriber silently overwrote the fields behind the array and the
interface went on accepting traffic it could no longer route: an ESP32 whose
peering session had spawned a handful of dynamic peers kept answering
identify sweeps and ARP while every IPv4 packet stopped being delivered.

Refuse past capacity and say so. Eight slots rather than four: a station
carrying the IP stack, an ether tap, a discovery domain and a peering
session is already at four before anything dynamic attaches.
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.

1 participant