From 47b61d5c42c4557e18df6d520cd9328a61617aa4 Mon Sep 17 00:00:00 2001 From: OBattler Date: Wed, 15 Jan 2020 01:09:23 +0100 Subject: [PATCH] Added a sanity fatal() to the x54x SCSI controller famility code. --- src/scsi/scsi_x54x.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/scsi/scsi_x54x.c b/src/scsi/scsi_x54x.c index cd4edbf79..4bced9593 100644 --- a/src/scsi/scsi_x54x.c +++ b/src/scsi/scsi_x54x.c @@ -260,6 +260,11 @@ x54x_bios_scsi_command(scsi_device_t *dev, uint8_t *cdb, uint8_t *buf, int len, return(completion_code(scsi_device_sense(dev))); if (len > 0) { + if (dev->buffer_length == -1) { + fatal("Buffer length -1 when doing SCSI DMA\n"); + return(0xff); + } + if (dev->phase == SCSI_PHASE_DATA_IN) { if (buf) memcpy(buf, dev->sc->temp_buffer, dev->buffer_length);