diff options
author | Prasad J Pandit | 2016-06-16 00:22:35 +0200 |
---|---|---|
committer | Paolo Bonzini | 2016-06-16 18:39:05 +0200 |
commit | 926cde5f3e4d2504ed161ed0cb771ac7cad6fd11 (patch) | |
tree | c246e98c0c0a3262f79e1e78a4d9056db9fce68c /include/hw/scsi | |
parent | scsi: esp: clean up handle_ti/esp_do_dma if s->do_cmd (diff) | |
download | qemu-926cde5f3e4d2504ed161ed0cb771ac7cad6fd11.tar.gz qemu-926cde5f3e4d2504ed161ed0cb771ac7cad6fd11.tar.xz qemu-926cde5f3e4d2504ed161ed0cb771ac7cad6fd11.zip |
scsi: esp: make cmdbuf big enough for maximum CDB size
While doing DMA read into ESP command buffer 's->cmdbuf', it could
write past the 's->cmdbuf' area, if it was transferring more than 16
bytes. Increase the command buffer size to 32, which is maximum when
's->do_cmd' is set, and add a check on 'len' to avoid OOB access.
Reported-by: Li Qiang <liqiang6-s@360.cn>
Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'include/hw/scsi')
-rw-r--r-- | include/hw/scsi/esp.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/include/hw/scsi/esp.h b/include/hw/scsi/esp.h index 6c795276c9..d2c48869e1 100644 --- a/include/hw/scsi/esp.h +++ b/include/hw/scsi/esp.h @@ -14,6 +14,7 @@ void esp_init(hwaddr espaddr, int it_shift, #define ESP_REGS 16 #define TI_BUFSZ 16 +#define ESP_CMDBUF_SZ 32 typedef struct ESPState ESPState; @@ -31,7 +32,7 @@ struct ESPState { SCSIBus bus; SCSIDevice *current_dev; SCSIRequest *current_req; - uint8_t cmdbuf[TI_BUFSZ]; + uint8_t cmdbuf[ESP_CMDBUF_SZ]; uint32_t cmdlen; uint32_t do_cmd; |