From 2b590d23004ee26dd8283d4109656353187552df Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sat, 27 Sep 2025 06:06:05 -0500 Subject: [PATCH] Update src/mesh/udp/UdpMulticastHandler.h Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- src/mesh/udp/UdpMulticastHandler.h | 5 +++++ 1 file changed, 5 insertions(+) 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) {