qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 1/1] virtio-serial: fix segfault on NULL port names
@ 2015-03-04  9:03 Amit Shah
  2015-03-04 10:49 ` Markus Armbruster
  0 siblings, 1 reply; 2+ messages in thread
From: Amit Shah @ 2015-03-04  9:03 UTC (permalink / raw)
  To: qemu list; +Cc: Amit Shah, Markus Armbruster

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(-)

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;
             }
         }
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-03-04 10:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-04  9:03 [Qemu-devel] [PATCH 1/1] virtio-serial: fix segfault on NULL port names Amit Shah
2015-03-04 10:49 ` Markus Armbruster

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).