Skip to content

Commit

Permalink
Fix rogue writes from within param_load()
Browse files Browse the repository at this point in the history
Here we are iterating over parameter indices but using byte length for
bounds, meaning we iterate to four times the actual number of
parameters. The subsequent param_check returns false for each of
the overrun indices, causing an out-of-bounds write each time.

This explains commit

  70b306a (Disable AT mode after reset, 2020-02-12).
  • Loading branch information
povik authored and tridge committed Mar 22, 2022
1 parent 05ae8c8 commit 4d436d6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Firmware/radio/parameters.c
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ __critical {
return false;
}

for (i = 0; i < sizeof(parameter_values); i++) {
for (i = 0; i < PARAM_MAX; i++) {
if (!param_check(i, parameter_values[i])) {
parameter_values[i] = parameter_info[i].default_value;
}
Expand Down

0 comments on commit 4d436d6

Please sign in to comment.