From 32642b7d7bfaefdf7fc8d974b3678647be8fe6c2 Mon Sep 17 00:00:00 2001 From: StevenCellist Date: Tue, 6 May 2025 13:39:26 +0200 Subject: [PATCH] [LoRaWAN] Handle bad block of LinkADRReq (#1497) --- src/protocols/LoRaWAN/LoRaWAN.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/protocols/LoRaWAN/LoRaWAN.cpp b/src/protocols/LoRaWAN/LoRaWAN.cpp index 2233a2f1..6fbc7cc5 100644 --- a/src/protocols/LoRaWAN/LoRaWAN.cpp +++ b/src/protocols/LoRaWAN/LoRaWAN.cpp @@ -2429,9 +2429,15 @@ void LoRaWANNode::preprocessMacLinkAdr(uint8_t* mPtr, uint8_t cLen, uint8_t* mAd case 1: case 2: case 3: + // clear the target 16-bit block + chMaskGrp0123 &= ~((uint64_t)0xFFFF << (16 * chMaskCntl)); + // set the new 16-bit value in that block chMaskGrp0123 |= (uint64_t)chMask << (16 * chMaskCntl); break; case 4: + // clear the target 16-bit block + chMaskGrp45 &= ~((uint32_t)0xFFFF); + // set the new 16-bit value in that block chMaskGrp45 |= (uint32_t)chMask; break; case 5: