FwUpdate binary: the chunk crc covers sid, offset and length too

This commit is contained in:
tth committed 2026-11-13 02:11:00 +01:00
1 parent 227edb9c63
commit a029863d66
2 files changed
+5 -2

No files matched your search

+4 -1
View File
@@ -535,7 +535,10 @@ int FwUpdate::handleBinary(const uint8_t *req, int len, uint8_t *reply, int repl
_w_drop++;
return 0;
}
if (11 + n > len || crc16_update(0xFFFF, &req[11], n) != crc) {
// crc over sid, offset, length AND data: seen on the bench, a fresh header
// with the previous transfer's chunk (data and its crc) behind it
uint16_t want = crc16_update(crc16_update(0xFFFF, &req[2], 7), &req[11], 11 + n <= len ? n : 0);
if (11 + n > len || want != crc) {
// the data got mangled on the way (seen: a fresh header with the previous
// chunk's data behind it) -- drop it, the bitmap asks for it again
_w_bad++;