Message ID | 36afc0db03021aa7259dc76107e8f5bb4ae61e10.1425459836.git.amit.shah@redhat.com |
---|---|
State | New |
Headers | show |
Amit Shah <amit.shah@redhat.com> writes: > 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. > > https://bugzilla.redhat.com/show_bug.cgi?id=1192775 > > Reported-by: vivian zhang <vivianzhang@redhat.com> > Signed-off-by: Amit Shah <amit.shah@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com>
diff --git a/hw/char/virtio-serial-bus.c b/hw/char/virtio-serial-bus.c index 47fbb34..acd1173 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; } }
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. https://bugzilla.redhat.com/show_bug.cgi?id=1192775 Reported-by: vivian zhang <vivianzhang@redhat.com> Signed-off-by: Amit Shah <amit.shah@redhat.com> --- hw/char/virtio-serial-bus.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)