Fix OOB flash write when DFU interrupted
If a DFU is restarted, the write indices aren't reset causing the image to be written out of bounds. The CRC check prevents the faulty image from booting but LittleFS still gets nuked.
This commit is contained in:
parent
fa1af55a45
commit
93d7da1691
|
@ -357,6 +357,8 @@ void DfuService::DfuImage::Init(size_t chunkSize, size_t totalSize, uint16_t exp
|
||||||
this->totalSize = totalSize;
|
this->totalSize = totalSize;
|
||||||
this->expectedCrc = expectedCrc;
|
this->expectedCrc = expectedCrc;
|
||||||
this->ready = true;
|
this->ready = true;
|
||||||
|
totalWriteIndex = 0;
|
||||||
|
bufferWriteIndex = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DfuService::DfuImage::Append(uint8_t* data, size_t size) {
|
void DfuService::DfuImage::Append(uint8_t* data, size_t size) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user