From 36cb84eaaae083010aaf5029257c10af0c707598 Mon Sep 17 00:00:00 2001 From: Maxim Poliakovski Date: Wed, 18 Oct 2023 11:21:38 +0200 Subject: [PATCH] mesh: fix write-out-of-bounds to BusStatus1. --- devices/common/scsi/mesh.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/devices/common/scsi/mesh.cpp b/devices/common/scsi/mesh.cpp index fce718f..4c349e6 100644 --- a/devices/common/scsi/mesh.cpp +++ b/devices/common/scsi/mesh.cpp @@ -49,6 +49,7 @@ void MeshController::reset(bool is_hard_reset) this->fifo_cnt = 0; this->int_mask = 0; this->xfer_count = 0; + this->src_id = 7; if (is_hard_reset) { this->bus_stat = 0; @@ -106,9 +107,9 @@ void MeshController::write(uint8_t reg_offset, uint8_t value) for (uint16_t mask = SCSI_CTRL_RST; mask >= SCSI_CTRL_SEL; mask >>= 1) { if ((new_stat ^ this->bus_stat) & mask) { if (new_stat & mask) - this->bus_obj->assert_ctrl_line(new_stat, mask); + this->bus_obj->assert_ctrl_line(this->src_id, mask); else - this->bus_obj->release_ctrl_line(new_stat, mask); + this->bus_obj->release_ctrl_line(this->src_id, mask); } } this->bus_stat = new_stat;