Blame 0026-scsi-megasas-null-terminate-bios-version-buffer.patch
|
|
cf91b1 |
From: Prasad J Pandit <pjp@fedoraproject.org>
|
|
|
cf91b1 |
Date: Tue, 7 Jun 2016 16:44:03 +0530
|
|
|
cf91b1 |
Subject: [PATCH] scsi: megasas: null terminate bios version buffer
|
|
|
cf91b1 |
|
|
|
cf91b1 |
While reading information via 'megasas_ctrl_get_info' routine,
|
|
|
cf91b1 |
a local bios version buffer isn't null terminated. Add the
|
|
|
cf91b1 |
terminating null byte to avoid any OOB access.
|
|
|
cf91b1 |
|
|
|
cf91b1 |
Reported-by: Li Qiang <liqiang6-s@360.cn>
|
|
|
cf91b1 |
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
|
|
|
cf91b1 |
Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
|
|
|
cf91b1 |
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
cf91b1 |
(cherry picked from commit 844864fbae66935951529408831c2f22367a57b6)
|
|
|
cf91b1 |
---
|
|
|
cf91b1 |
hw/scsi/megasas.c | 1 +
|
|
|
cf91b1 |
1 file changed, 1 insertion(+)
|
|
|
cf91b1 |
|
|
|
cf91b1 |
diff --git a/hw/scsi/megasas.c b/hw/scsi/megasas.c
|
|
|
cf91b1 |
index cc66d36..a9ffc32 100644
|
|
|
cf91b1 |
--- a/hw/scsi/megasas.c
|
|
|
cf91b1 |
+++ b/hw/scsi/megasas.c
|
|
|
cf91b1 |
@@ -773,6 +773,7 @@ static int megasas_ctrl_get_info(MegasasState *s, MegasasCmd *cmd)
|
|
|
cf91b1 |
|
|
|
cf91b1 |
ptr = memory_region_get_ram_ptr(&pci_dev->rom);
|
|
|
cf91b1 |
memcpy(biosver, ptr + 0x41, 31);
|
|
|
cf91b1 |
+ biosver[31] = 0;
|
|
|
cf91b1 |
memcpy(info.image_component[1].name, "BIOS", 4);
|
|
|
cf91b1 |
memcpy(info.image_component[1].version, biosver,
|
|
|
cf91b1 |
strlen((const char *)biosver));
|