qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH] virtio-serial: don't crash on invalid input


From: Michael S. Tsirkin
Subject: [Qemu-devel] [PATCH] virtio-serial: don't crash on invalid input
Date: Tue, 22 Mar 2011 18:32:50 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

Fix crash on invalid input in virtio-serial.
Discovered by code review, untested.

Signed-off-by: Michael S. Tsirkin <address@hidden>
---
 hw/virtio-serial-bus.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/hw/virtio-serial-bus.c b/hw/virtio-serial-bus.c
index e0bf6c5..8807a2f 100644
--- a/hw/virtio-serial-bus.c
+++ b/hw/virtio-serial-bus.c
@@ -654,6 +654,9 @@ static int virtio_serial_load(QEMUFile *f, void *opaque, 
int version_id)
 
         id = qemu_get_be32(f);
         port = find_port_by_id(s, id);
+        if (!port) {
+            return -EINVAL;
+        }
 
         port->guest_connected = qemu_get_byte(f);
         host_connected = qemu_get_byte(f);
-- 
1.7.3.2.91.g446ac



reply via email to

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