提交 b18a755c 编写于 作者: A Amit Shah

virtio-serial: fix segfault on NULL port names

Commit d0a0bfe6 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=1192775Reported-by: Nvivian zhang <vivianzhang@redhat.com>
Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
Signed-off-by: NAmit Shah <amit.shah@redhat.com>
上级 4ba4df40
......@@ -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;
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册