]> git.proxmox.com Git - mirror_qemu.git/commit
scsi-generic: fix buffer overflow on block limits inquiry
authorPaolo Bonzini <pbonzini@redhat.com>
Wed, 10 May 2023 16:15:25 +0000 (18:15 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 18 May 2023 06:53:51 +0000 (08:53 +0200)
commit9bd634b2f5e2f10fe35d7609eb83f30583f2e15a
tree658e4afb04d3e529da16f8ba56160bf0b5709d3c
parentc9214c935564775483ee4865857dbef1bd4a7ad9
scsi-generic: fix buffer overflow on block limits inquiry

Using linux 6.x guest, at boot time, an inquiry on a scsi-generic
device makes qemu crash.  This is caused by a buffer overflow when
scsi-generic patches the block limits VPD page.

Do the operations on a temporary on-stack buffer that is guaranteed
to be large enough.

Reported-by: Théo Maillart <tmaillart@freebox.fr>
Analyzed-by: Théo Maillart <tmaillart@freebox.fr>
Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
hw/scsi/scsi-generic.c