From f45419d7968a86b1f71e0a1565a50ce186a6f4f9 Mon Sep 17 00:00:00 2001 From: OBattler Date: Tue, 14 Jan 2020 20:59:54 +0100 Subject: [PATCH] Added another sanity fatal() to the hard disk image code. --- src/disk/hdd_image.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/disk/hdd_image.c b/src/disk/hdd_image.c index ec48e24e5..b5d943fdd 100644 --- a/src/disk/hdd_image.c +++ b/src/disk/hdd_image.c @@ -751,7 +751,7 @@ hdd_image_read(uint8_t id, uint32_t sector, uint32_t count, uint8_t *buffer) int i; if (fseeko64(hdd_images[id].file, ((uint64_t)(sector) << 9LL) + hdd_images[id].base, SEEK_SET) == -1) { - fatal("Hard disk image %i: Error during seek\n", id); + fatal("Hard disk image %i: Read error during seek\n", id); return; } @@ -795,7 +795,10 @@ hdd_image_write(uint8_t id, uint32_t sector, uint32_t count, uint8_t *buffer) { int i; - fseeko64(hdd_images[id].file, ((uint64_t)(sector) << 9LL) + hdd_images[id].base, SEEK_SET); + if (fseeko64(hdd_images[id].file, ((uint64_t)(sector) << 9LL) + hdd_images[id].base, SEEK_SET) == -1) { + fatal("Hard disk image %i: Write error during seek\n", id); + return; + } for (i = 0; i < count; i++) { if (feof(hdd_images[id].file))