projects
/
qemu.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
6cdfab2
)
virtio-serial: don't crash on invalid input
author
Michael S. Tsirkin
<mst@redhat.com>
Tue, 22 Mar 2011 16:32:50 +0000
(18:32 +0200)
committer
Michael S. Tsirkin
<mst@redhat.com>
Mon, 28 Mar 2011 16:34:23 +0000
(18:34 +0200)
Fix crash on invalid input in virtio-serial.
Discovered by code review, untested.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
hw/virtio-serial-bus.c
patch
|
blob
|
history
diff --git
a/hw/virtio-serial-bus.c
b/hw/virtio-serial-bus.c
index a82fbe9ba4036dfe7130b6caf188ce4921dbc26e..62273799b6cfaa1b6ab781dd63b05a546467cba1 100644
(file)
--- a/
hw/virtio-serial-bus.c
+++ b/
hw/virtio-serial-bus.c
@@
-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);