Skip to content

Commit

Permalink
Merge pull request #809 from ali1234/erasebounds
Browse files Browse the repository at this point in the history
Firmware: reject erase commands beyond the end of external flash
  • Loading branch information
Daft-Freak authored Mar 5, 2023
2 parents c47e2a9 + c53458f commit d45e728
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions firmware/firmware.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,10 @@ static void erase_flash_game(uint32_t offset) {
if(offset & (qspi_flash_sector_size - 1))
return;

// reject beyond end of flash
if(offset >= qspi_flash_size)
return;

// attempt to get size, falling back to a single sector
int erase_size = 1;
for(auto &game : game_list) {
Expand Down

0 comments on commit d45e728

Please sign in to comment.