Commit fbe0c559 authored by Michael S. Tsirkin's avatar Michael S. Tsirkin
Browse files

virtio-serial: don't crash on invalid input



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

Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
parent 6cdfab28
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -594,6 +594,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);