Skip to content

Commit 644d0d4

Browse files
niklaswallCopilotthebentern
authored
Fix for preserving pki_encrypted and public_key when relaying UDP multicast packets to radio. (#9916)
* Fix for preserving pki_encrypted and public_key when relaying UDP multicast packets to radio. PKI DMs sent over UDP multicast had their pki_encrypted flag and public_key fields explicitly cleared before being forwarded to the LoRa radio. This caused the receiving node to treat the packet as a channel-encrypted message it couldn't decrypt, silently dropping it. The MQTT ingress path correctly preserves these fields. The UDP multicast ingress path should behave the same way. * Zeroize MeshPacket before decoding Zeroize MeshPacket before decoding to prevent data leakage. Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
1 parent f04746a commit 644d0d4

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

src/mesh/udp/UdpMulticastHandler.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class UdpMulticastHandler final
6969
// FIXME(PORTDUINO): arduino lacks IPAddress::toString()
7070
LOG_DEBUG("UDP broadcast from: %s, len=%u", packet.remoteIP().toString().c_str(), packetLength);
7171
#endif
72-
meshtastic_MeshPacket mp;
72+
meshtastic_MeshPacket mp = meshtastic_MeshPacket_init_zero;
7373
LOG_DEBUG("Decoding MeshPacket from UDP len=%u", packetLength);
7474
bool isPacketDecoded = pb_decode_from_bytes(packet.data(), packetLength, &meshtastic_MeshPacket_msg, &mp);
7575
if (isPacketDecoded && router && mp.which_payload_variant == meshtastic_MeshPacket_encrypted_tag) {
@@ -79,9 +79,6 @@ class UdpMulticastHandler final
7979
return;
8080
}
8181
mp.transport_mechanism = meshtastic_MeshPacket_TransportMechanism_TRANSPORT_MULTICAST_UDP;
82-
mp.pki_encrypted = false;
83-
mp.public_key.size = 0;
84-
memset(mp.public_key.bytes, 0, sizeof(mp.public_key.bytes));
8582
UniquePacketPoolPacket p = packetPool.allocUniqueCopy(mp);
8683
// Unset received SNR/RSSI
8784
p->rx_snr = 0;

0 commit comments

Comments
 (0)