mirror of
https://github.com/mii443/qemu.git
synced 2025-08-22 15:15:46 +00:00
hw/nvme: fix buffer overrun in nvme_changed_nslist (CVE-2021-3947)
Fix missing offset verification. Cc: qemu-stable@nongnu.org Cc: Philippe Mathieu-Daudé <philmd@redhat.com> Reported-by: Qiuhao Li <Qiuhao.Li@outlook.com> Fixes:f432fdfa12
("support changed namespace asynchronous event") Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Klaus Jensen <k.jensen@samsung.com> (cherry picked from commite2c57529c9
) Signed-off-by: Michael Roth <michael.roth@amd.com>
This commit is contained in:
committed by
Michael Roth
parent
932333c5f0
commit
2b2eb343a0
@ -4164,6 +4164,11 @@ static uint16_t nvme_changed_nslist(NvmeCtrl *n, uint8_t rae, uint32_t buf_len,
|
||||
int i = 0;
|
||||
uint32_t nsid;
|
||||
|
||||
if (off >= sizeof(nslist)) {
|
||||
trace_pci_nvme_err_invalid_log_page_offset(off, sizeof(nslist));
|
||||
return NVME_INVALID_FIELD | NVME_DNR;
|
||||
}
|
||||
|
||||
memset(nslist, 0x0, sizeof(nslist));
|
||||
trans_len = MIN(sizeof(nslist) - off, buf_len);
|
||||
|
||||
|
Reference in New Issue
Block a user