aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorAmit Shah <amit.shah@redhat.com>2015-03-04 14:29:52 +0530
committerAmit Shah <amit.shah@redhat.com>2015-03-11 16:37:45 +0530
commitb18a755c4266a340a25ab4118525bd57c3dfc3fa (patch)
tree4bb910b7a8a1e0193b1da1c1fed794239d495383 /hw
parent4ba4df405c766b7f9e46ef145e140961155348e6 (diff)
virtio-serial: fix segfault on NULL port names
Commit d0a0bfe6729ef6044d76ea49fafa07e29fa598bd added checks for port names, but didn't add a check to ensure port->name is non-NULL. This results in a SIGSEGV when adding a port when one of the previously-added ports didn't have the 'name' property set. https://bugzilla.redhat.com/show_bug.cgi?id=1192775 Reported-by: vivian zhang <vivianzhang@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Amit Shah <amit.shah@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/char/virtio-serial-bus.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/hw/char/virtio-serial-bus.c b/hw/char/virtio-serial-bus.c
index 9a029d2130..c86814f059 100644
--- a/hw/char/virtio-serial-bus.c
+++ b/hw/char/virtio-serial-bus.c
@@ -64,7 +64,7 @@ static VirtIOSerialPort *find_port_by_name(char *name)
VirtIOSerialPort *port;
QTAILQ_FOREACH(port, &vser->ports, next) {
- if (!strcmp(port->name, name)) {
+ if (port->name && !strcmp(port->name, name)) {
return port;
}
}