Skip to content

Commit

Permalink
Fix D64 to not read past the end of a sector on large reads.
Browse files Browse the repository at this point in the history
  • Loading branch information
FozzTexx authored and tschak909 committed Nov 9, 2024
1 parent 41b8fc2 commit 1fecea8
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/meatloaf/disk/d64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,9 @@ uint16_t D64MStream::readFile(uint8_t *buf, uint16_t size)

if (size > 0)
{
// Only read up to the bytes remaining in this sector
size = std::min(size, (uint16_t) (block_size - sector_offset % block_size));

bytesRead += readContainer(buf, size);
sector_offset += bytesRead;

Expand Down

0 comments on commit 1fecea8

Please sign in to comment.