virtio-serial: don't crash on invalid input
Fix crash on invalid input in virtio-serial. Discovered by code review, untested. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
parent
6cdfab2868
commit
fbe0c55910
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user