qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 1/1] virtio-serial: fix segfault on NULL port names


From: Amit Shah
Subject: [Qemu-devel] [PATCH 1/1] virtio-serial: fix segfault on NULL port names
Date: Wed, 4 Mar 2015 14:33:56 +0530

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 <address@hidden>
Signed-off-by: Amit Shah <address@hidden>
---
 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]