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 #72

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
11 changes: 9 additions & 2 deletions lbm_lib/smtc_modem_core/radio_drivers/sx126x_driver/src/sx126x.c
Original file line number Diff line number Diff line change
Expand Up @@ -1413,8 +1413,15 @@ sx126x_status_t sx126x_add_registers_to_retention_list( const void* context, con

if( status == SX126X_STATUS_OK )
{
const uint8_t initial_nb_of_registers = buffer[0];
uint8_t* register_list = &buffer[1];
uint8_t initial_nb_of_registers = buffer[0];
uint8_t* register_list = &buffer[1];

// sanity check - in case invalid value read -> set to zero
if(initial_nb_of_registers > SX126X_MAX_NB_REG_IN_RETENTION)
{
initial_nb_of_registers = 0;
buffer[0] = 0;
}

for( uint8_t index = 0; index < register_nb; index++ )
{
Expand Down