Skip to content

Commit

Permalink
[LoRaWAN] Remove variable length array (CI_BUILD_ALL)
Browse files Browse the repository at this point in the history
  • Loading branch information
jgromes committed Jan 14, 2024
1 parent 132aae9 commit 8c5ae6d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/protocols/LoRaWAN/LoRaWAN.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1417,7 +1417,7 @@ int16_t LoRaWANNode::downlink(uint8_t* data, size_t* len, LoRaWANEvent_t* event)
// process FOpts (if there are any)
if(foptsLen > 0) {
// there are some Fopts, decrypt them
uint8_t fopts[RADIOLIB_MAX(RADIOLIB_LORAWAN_FHDR_FOPTS_LEN_MASK, (int)foptsLen)];
uint8_t fopts[RADIOLIB_LORAWAN_FHDR_FOPTS_LEN_MASK];

// TODO it COULD be the case that the assumed FCnt rollover is incorrect, if possible figure out a way to catch this and retry with just fcnt16
// if there are <= 15 bytes of FOpts, they are in the FHDR, otherwise they are in the payload
Expand Down

3 comments on commit 8c5ae6d

@StevenCellist
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jgromes warning!! This is not correct. There can be fopts in the normal payload when fport = 0. There could in theory be up to 255 bytes (max payload length), although maximum could be set to 51 or whatever the SF12 max payload length is. Longest I've seen is 43 if I recall correctly.

@jgromes
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@StevenCellist thanks for the heads up - I'll replace it with a proper dynamically allcoated array then.

@StevenCellist
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally fine with a fixed maximum of 51 or so, but that's up to you :)

Please sign in to comment.