diff --git a/src/mesh/udp/UdpMulticastHandler.h b/src/mesh/udp/UdpMulticastHandler.h index 0a27a316e..897c2eb47 100644 --- a/src/mesh/udp/UdpMulticastHandler.h +++ b/src/mesh/udp/UdpMulticastHandler.h @@ -78,6 +78,11 @@ class UdpMulticastHandler final if (!mp || !udp) { return false; } + // Validate channel index before accessing + if (chIndex < 0 || chIndex >= channels.size()) { + LOG_ERROR("Invalid channel index %d in UDP onSend", chIndex); + return false; + } // Check if uplink is enabled for this specific channel auto &ch = channels.getByIndex(chIndex); if (!ch.settings.uplink_enabled) {