Skip to content

Commit 93d7da1

Browse files
mark9064JF002
authored andcommitted
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.
1 parent fa1af55 commit 93d7da1

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/components/ble/DfuService.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,8 @@ void DfuService::DfuImage::Init(size_t chunkSize, size_t totalSize, uint16_t exp
357357
this->totalSize = totalSize;
358358
this->expectedCrc = expectedCrc;
359359
this->ready = true;
360+
totalWriteIndex = 0;
361+
bufferWriteIndex = 0;
360362
}
361363

362364
void DfuService::DfuImage::Append(uint8_t* data, size_t size) {

0 commit comments

Comments
 (0)