bounds check flash writes

This commit is contained in:
Matthew Kennedy 2020-12-10 23:36:45 -08:00
parent c711252791
commit 36f52312db
1 changed files with 5 additions and 0 deletions

View File

@ -156,6 +156,11 @@ void RunBootloaderLoop()
{ {
sendNak(); sendNak();
} }
// Don't allow out of bounds writes
else if (embeddedData < 0 || embeddedData > 26 * 1024)
{
sendNak();
}
else else
{ {
Flash::Write(appFlashAddr + embeddedData, &frame.data8[0], frame.DLC); Flash::Write(appFlashAddr + embeddedData, &frame.data8[0], frame.DLC);