|
|
f37f50b |
------------------------------------------------------------------------
|
|
|
f37f50b |
*From*: P J P
|
|
|
f37f50b |
*Subject*: [Qemu-devel] [PATCH 1/2] scsi: check command buffer length
|
|
|
f37f50b |
before write(CVE-2016-4439)
|
|
|
f37f50b |
*Date*: Thu, 19 May 2016 16:09:30 +0530
|
|
|
f37f50b |
|
|
|
f37f50b |
------------------------------------------------------------------------
|
|
|
f37f50b |
|
|
|
f37f50b |
From: Prasad J Pandit <address@hidden>
|
|
|
f37f50b |
|
|
|
f37f50b |
The 53C9X Fast SCSI Controller(FSC) comes with an internal 16-byte
|
|
|
f37f50b |
FIFO buffer. It is used to handle command and data transfer. While
|
|
|
f37f50b |
writing to this command buffer 's->cmdbuf[TI_BUFSZ=16]', a check
|
|
|
f37f50b |
was missing to validate input length. Add check to avoid OOB write
|
|
|
f37f50b |
access.
|
|
|
f37f50b |
|
|
|
f37f50b |
Fixes CVE-2016-4439
|
|
|
f37f50b |
Reported-by: Li Qiang <address@hidden>
|
|
|
f37f50b |
|
|
|
f37f50b |
Signed-off-by: Prasad J Pandit <address@hidden>
|
|
|
f37f50b |
---
|
|
|
f37f50b |
hw/scsi/esp.c | 6 +++++-
|
|
|
f37f50b |
1 file changed, 5 insertions(+), 1 deletion(-)
|
|
|
f37f50b |
|
|
|
f37f50b |
diff --git a/tools/qemu-xen-traditional/hw/esp.c b/tools/qemu-xen-traditional/hw/esp.c
|
|
|
f37f50b |
index 8961be2..01497e6 100644
|
|
|
f37f50b |
--- a/tools/qemu-xen-traditional/hw/esp.c
|
|
|
f37f50b |
+++ b/tools/qemu-xen-traditional/hw/esp.c
|
|
|
f37f50b |
@@ -448,7 +448,11 @@ void esp_reg_write(ESPState *s, uint32_t saddr, uint64_t val)
|
|
|
f37f50b |
break;
|
|
|
f37f50b |
case ESP_FIFO:
|
|
|
f37f50b |
if (s->do_cmd) {
|
|
|
f37f50b |
- s->cmdbuf[s->cmdlen++] = val & 0xff;
|
|
|
f37f50b |
+ if (s->cmdlen < TI_BUFSZ) {
|
|
|
f37f50b |
+ s->cmdbuf[s->cmdlen++] = val & 0xff;
|
|
|
f37f50b |
+ } else {
|
|
|
f37f50b |
+ ESP_ERROR("fifo overrun\n");
|
|
|
f37f50b |
+ }
|
|
|
f37f50b |
} else if (s->ti_size == TI_BUFSZ - 1) {
|
|
|
f37f50b |
ESP_ERROR("fifo overrun\n");
|
|
|
f37f50b |
} else {
|
|
|
f37f50b |
--
|
|
|
f37f50b |
2.5.5
|
|
|
f37f50b |
|