fix(radio): MeshBeacon heap leak and runtime packet payload size check (#11573)

* Fix for MeshBeacon packet leakage

* fix: add runtime payload size check against radiobuffer

* review fix for PR#11573: clear target radio settings before MeshBeacon packet release

* add unit test for radio buffer capacity check, removing related assert for the test

* review fix for PR#11573: add explicit verifaction against rejected packets
This commit is contained in:
Tadayoshi MIURA authored and GitHub committed 2026-08-23 11:00:30 +00:00
1 parent 05f6474108
commit ac330e6a6b
4 files changed
+58 -5

No files matched your search

+8 -2
View File
@@ -286,7 +286,10 @@ void MeshBeaconBroadcastModule::sendBeaconPacket(meshtastic_MeshPacket *p, mesht
const bool cryptoOverride =
has_channel && overrideChannel && (overrideChannel->name[0] != '\0' || overrideChannel->psk.size > 0);
if (!cryptoOverride) {
router->send(p);
if (router->send(p) == ERRNO_SHOULD_RELEASE) {
MeshBeaconModule::clearTargetRadioSettings(p);
packetPool.release(p);
}
return;
}
@@ -300,7 +303,10 @@ void MeshBeaconBroadcastModule::sendBeaconPacket(meshtastic_MeshPacket *p, mesht
primary.settings = beaconChannelSettings(saved, targetPreset, overrideChannel);
channels.fixupChannel(channels.getPrimaryIndex());
router->send(p); // encrypts with the beacon channel's key and stamps its hash
if (router->send(p) == ERRNO_SHOULD_RELEASE) { // encrypts with the beacon channel's key and stamps its hash
MeshBeaconModule::clearTargetRadioSettings(p);
packetPool.release(p);
}
primary.settings = saved;
channels.fixupChannel(channels.getPrimaryIndex());