[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 14/23] openpic: avoid buffer overrun on incoming mig

From: Michael S. Tsirkin
Subject: [Qemu-devel] [PATCH 14/23] openpic: avoid buffer overrun on incoming migration
Date: Tue, 3 Dec 2013 18:28:59 +0200

From: Michael Roth <address@hidden>


opp->nb_cpus is read from the wire and used to determine how many
IRQDest elements to read into opp->dst[]. If the value exceeds the
length of opp->dst[], MAX_CPU, opp->dst[] can be overrun with arbitrary
data from the wire.

Fix this by failing migration if the value read from the wire exceeds

Signed-off-by: Michael Roth <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>
 hw/intc/openpic.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/hw/intc/openpic.c b/hw/intc/openpic.c
index 7df72f4..ab8c43d 100644
--- a/hw/intc/openpic.c
+++ b/hw/intc/openpic.c
@@ -1429,6 +1429,9 @@ static int openpic_load(QEMUFile* f, void *opaque, int 
     qemu_get_be32s(f, &opp->tfrr);
     qemu_get_be32s(f, &opp->nb_cpus);
+    if (opp->nb_cpus > MAX_CPU) {
+        return -EINVAL;
+    }
     for (i = 0; i < opp->nb_cpus; i++) {
         qemu_get_sbe32s(f, &opp->dst[i].ctpr);

reply via email to

[Prev in Thread] Current Thread [Next in Thread]