scsi: esp: make cmdbuf big enough for maximum CDB size
commit926cde5f3e4d2504ed161ed0cb771ac7cad6fd11
authorPrasad J Pandit <pjp@fedoraproject.org>
Wed, 15 Jun 2016 22:22:35 +0000 (16 00:22 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 16 Jun 2016 16:39:05 +0000 (16 18:39 +0200)
treec246e98c0c0a3262f79e1e78a4d9056db9fce68c
parent7f0b6e114ae4e142e2b3dfc9fac138f4a30edc4f
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>
hw/scsi/esp.c
include/hw/scsi/esp.h