hdd_image: Don't return read error on out-of-bounds reads

This commit is contained in:
RichardG867
2024-11-03 11:22:27 -03:00
parent 26005b37b1
commit 558176e454
2 changed files with 3 additions and 3 deletions

View File

@@ -542,7 +542,7 @@ hdd_image_read(uint8_t id, uint32_t sector, uint32_t count, uint8_t *buffer)
num_read = fread(buffer, 512, count, hdd_images[id].file);
hdd_images[id].pos = sector + num_read;
if (num_read < count)
if ((num_read < count) && !feof(hdd_images[id].file))
return -1;
}