From 2b94cd2b9670cd65e99dbcd796bdf98ca11798a7 Mon Sep 17 00:00:00 2001 From: OBattler Date: Wed, 15 Jan 2020 00:49:42 +0100 Subject: [PATCH] Fixed potential SCSI ID overruns in the SCSI hard diks, CD-ROM, and Iomega ZIP codes. --- src/disk/zip.c | 2 +- src/scsi/scsi_cdrom.c | 2 +- src/scsi/scsi_disk.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/disk/zip.c b/src/disk/zip.c index 5e962115c..8c03f861a 100644 --- a/src/disk/zip.c +++ b/src/disk/zip.c @@ -2368,7 +2368,7 @@ zip_hard_reset(void) zip_log("ZIP hard_reset drive=%d\n", c); /* Make sure to ignore any SCSI ZIP drive that has an out of range ID. */ - if ((zip_drives[c].bus_type == ZIP_BUS_SCSI) && (zip_drives[c].scsi_device_id > SCSI_ID_MAX)) + if ((zip_drives[c].bus_type == ZIP_BUS_SCSI) && (zip_drives[c].scsi_device_id >= SCSI_ID_MAX)) continue; /* Make sure to ignore any ATAPI ZIP drive that has an out of range IDE channel. */ diff --git a/src/scsi/scsi_cdrom.c b/src/scsi/scsi_cdrom.c index 72d3b2e2a..3667567fc 100644 --- a/src/scsi/scsi_cdrom.c +++ b/src/scsi/scsi_cdrom.c @@ -2545,7 +2545,7 @@ scsi_cdrom_drive_reset(int c) ide_t *id; /* Make sure to ignore any SCSI CD-ROM drive that has an out of range ID. */ - if ((drv->bus_type == CDROM_BUS_SCSI) && (drv->scsi_device_id > SCSI_ID_MAX)) + if ((drv->bus_type == CDROM_BUS_SCSI) && (drv->scsi_device_id >= SCSI_ID_MAX)) return; /* Make sure to ignore any ATAPI CD-ROM drive that has an out of range IDE channel. */ diff --git a/src/scsi/scsi_disk.c b/src/scsi/scsi_disk.c index 91256b4dc..6203a7ac4 100644 --- a/src/scsi/scsi_disk.c +++ b/src/scsi/scsi_disk.c @@ -1212,7 +1212,7 @@ scsi_disk_hard_reset(void) scsi_disk_log("SCSI disk hard_reset drive=%d\n", c); /* Make sure to ignore any SCSI disk that has an out of range ID. */ - if (hdd[c].scsi_id > SCSI_ID_MAX) + if (hdd[c].scsi_id >= SCSI_ID_MAX) continue; /* Make sure to ignore any SCSI disk whose image file name is empty. */