mirror of https://github.com/rusefi/wideband.git
validate flash request
This commit is contained in:
parent
a418c9903f
commit
ec20b7ed9d
|
@ -151,7 +151,16 @@ void RunBootloaderLoop()
|
|||
case 0x02: // opcode 2 is "write flash data"
|
||||
// Embedded data is the flash address
|
||||
|
||||
Flash::Write(appFlashAddr + embeddedData, &frame.data8[0], frame.DLC);
|
||||
// Don't allow misaligned writes
|
||||
if (embeddedData % sizeof(flashdata_t) != 0 || frame.DLC % sizeof(flashdata_t) != 0)
|
||||
{
|
||||
sendNak();
|
||||
}
|
||||
else
|
||||
{
|
||||
Flash::Write(appFlashAddr + embeddedData, &frame.data8[0], frame.DLC);
|
||||
sendAck();
|
||||
}
|
||||
|
||||
break;
|
||||
case 0x03: // opcode 3 is "boot app"
|
||||
|
|
Loading…
Reference in New Issue