Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HARD FAULT : Add sanity check to sx126x driver when handling retention list #1615

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/radio/sx126x/radio.c
Original file line number Diff line number Diff line change
Expand Up @@ -1119,9 +1119,16 @@ void RadioAddRegisterToRetentionList( uint16_t registerAddress )
// Read the address and registers already added to the list
SX126xReadRegisters( REG_RETENTION_LIST_BASE_ADDRESS, buffer, 9 );

const uint8_t nbOfRegisters = buffer[0];
uint8_t nbOfRegisters = buffer[0];
uint8_t* registerList = &buffer[1];

// in case more than maximum read -> set to 0
if(nbOfRegisters > MAX_NB_REG_IN_RETENTION)
{
nbOfRegisters = 0;
buffer[0] = 0; // set also to zero - invalid value was read-out
}

// Check if the register given as parameter is already added to the list
for( uint8_t i = 0; i < nbOfRegisters; i++ )
{
Expand Down