chunk CMD_READ_MEM_DOWNLOADED by the OLD frame size reply_old clamps its payload to PM3_CMD_DATA_SIZE_OLD but the sender still

chunked by PM3_CMD_DATA_SIZE. Identical today, but if the NG size moves the
chunk would be built oversized, truncated on the wire, and still announced
at full length in oldarg[1] - the client would copy past the valid bytes and
advance by the wrong stride. Bound the client's OLD download branch by the
same constant.
This commit is contained in:
iceman1001 committed 2026-08-30 13:33:50 +02:00
1 parent ed066d84aa
commit 1d87a6c192
2 files changed
+7 -2

No files matched your search

+3
View File
@@ -1289,6 +1289,9 @@ static bool dl_it(uint8_t *dest, uint32_t bytes, PacketResponseNG *response, siz
offset = response->oldarg[0];
copy_bytes = response->oldarg[1];
src = response->data.asBytes;
// an OLD frame carries at most PM3_CMD_DATA_SIZE_OLD valid bytes,
// whatever oldarg[1] claims
copy_bytes = MIN(copy_bytes, (uint32_t)PM3_CMD_DATA_SIZE_OLD);
}
copy_bytes = MIN(bytes - bytes_completed, copy_bytes);