mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-06 01:03:55 -06:00
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>
This commit is contained in:
parent
7f0b6e114a
commit
926cde5f3e
2 changed files with 6 additions and 3 deletions
|
@ -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;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue