5a0f88db96
Fix CVE-2013-4148 (bnc#864812), CVE-2013-4149 (bnc#864649), CVE-2013-4150 (bnc#864650), CVE-2013-4151 (bnc#864653), CVE-2013-4526 (bnc#864671), CVE-2013-4527 (bnc#864673), CVE-2013-4529 (bnc#864678), CVE-2013-4530 (bnc#864682), CVE-2013-4531 (bnc#864796), CVE-2013-4533 (bnc#864655), CVE-2013-4534 (bnc#864811), CVE-2013-4535 / CVE-2013-4536 (bnc#864665), CVE-2013-4537 (bnc#864391), CVE-2013-4538 (bnc#864769), CVE-2013-4539 (bnc#864805), CVE-2013-4540 (bnc#864801), CVE-2013-4541 (bnc#864802), CVE-2013-4542 (bnc#864804), CVE-2013-6399 (bnc#864814), CVE-2014-0182 (bnc#874788) OBS-URL: https://build.opensuse.org/request/show/235280 OBS-URL: https://build.opensuse.org/package/show/Virtualization/qemu?expand=0&rev=211
58 lines
1.8 KiB
Diff
58 lines
1.8 KiB
Diff
From 5d2ec830b492cc18205d3a10d9ed3595559cd831 Mon Sep 17 00:00:00 2001
|
|
From: "Michael S. Tsirkin" <mst@redhat.com>
|
|
Date: Mon, 28 Apr 2014 16:08:23 +0300
|
|
Subject: [PATCH] virtio: validate config_len on load
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
Malformed input can have config_len in migration stream
|
|
exceed the array size allocated on destination, the
|
|
result will be heap overflow.
|
|
|
|
To fix, that config_len matches on both sides.
|
|
|
|
CVE-2014-0182
|
|
|
|
Reported-by: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
|
|
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
|
|
Signed-off-by: Juan Quintela <quintela@redhat.com>
|
|
|
|
--
|
|
|
|
v2: use %ix and %zx to print config_len values
|
|
Signed-off-by: Juan Quintela <quintela@redhat.com>
|
|
(cherry picked from commit a890a2f9137ac3cf5b607649e66a6f3a5512d8dc)
|
|
[AF: BNC#874788]
|
|
Signed-off-by: Andreas Färber <afaerber@suse.de>
|
|
---
|
|
hw/virtio/virtio.c | 8 +++++++-
|
|
1 file changed, 7 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
|
|
index a70169a..7f4e7ec 100644
|
|
--- a/hw/virtio/virtio.c
|
|
+++ b/hw/virtio/virtio.c
|
|
@@ -898,6 +898,7 @@ int virtio_set_features(VirtIODevice *vdev, uint32_t val)
|
|
int virtio_load(VirtIODevice *vdev, QEMUFile *f)
|
|
{
|
|
int i, ret;
|
|
+ int32_t config_len;
|
|
uint32_t num;
|
|
uint32_t features;
|
|
uint32_t supported_features;
|
|
@@ -924,7 +925,12 @@ int virtio_load(VirtIODevice *vdev, QEMUFile *f)
|
|
features, supported_features);
|
|
return -1;
|
|
}
|
|
- vdev->config_len = qemu_get_be32(f);
|
|
+ config_len = qemu_get_be32(f);
|
|
+ if (config_len != vdev->config_len) {
|
|
+ error_report("Unexpected config length 0x%x. Expected 0x%zx",
|
|
+ config_len, vdev->config_len);
|
|
+ return -1;
|
|
+ }
|
|
qemu_get_buffer(f, vdev->config, vdev->config_len);
|
|
|
|
num = qemu_get_be32(f);
|