Skip to content

Commit

Permalink
Firmware: reject erase commands beyond the end of external flash
Browse files Browse the repository at this point in the history
  • Loading branch information
ali1234 committed Mar 5, 2023
1 parent c47e2a9 commit c53458f
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 c53458f

Please sign in to comment.