iface: bound the subscriber table - #556
Open
TurkeyMan wants to merge 1 commit into
Open
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
subscribe()wrote_subscribers[_num_subscribers++]into a fixedInterfaceSubscriber[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 --jsonheap 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