You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ja...@apache.org on 2026/10/26 12:38:50 UTC
(mynewt-core) 04/07: net/lora: Fix buffer space check for DlChannelAns
This is an automated email from the ASF dual-hosted git repository.
sjanc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git
commit 672f738138778c44d139c1c599ac86f1f9c84485
Author: Szymon Janc <sz...@codecoup.pl>
AuthorDate: Sun Oct 25 21:58:59 2026 +0100
net/lora: Fix buffer space check for DlChannelAns
DlChannelAns is 2 bytes long but only space for 1 byte was checked,
so with one byte left in the MAC commands buffer status byte was
written past the buffer.
Assisted-by: Claude:claude-opus-5-5
---
net/lora/node/src/mac/LoRaMac.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/lora/node/src/mac/LoRaMac.c b/net/lora/node/src/mac/LoRaMac.c
index 1c3fb0a5c..790ec926e 100644
--- a/net/lora/node/src/mac/LoRaMac.c
+++ b/net/lora/node/src/mac/LoRaMac.c
@@ -1692,7 +1692,7 @@ AddMacCommand(uint8_t cmd, uint8_t p1, uint8_t p2)
}
break;
case MOTE_MAC_DL_CHANNEL_ANS:
- if (MacCommandsBufferIndex < bufLen) {
+ if (MacCommandsBufferIndex < (bufLen - 1)) {
MacCommandsBuffer[MacCommandsBufferIndex++] = cmd;
// Status: Uplink frequency exists, Channel frequency OK
MacCommandsBuffer[MacCommandsBufferIndex++] = p1;