From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36426) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YT5Du-0004Y9-AN for qemu-devel@nongnu.org; Wed, 04 Mar 2015 04:04:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YT5Dr-0003jV-Jv for qemu-devel@nongnu.org; Wed, 04 Mar 2015 04:04:10 -0500 Received: from mx1.redhat.com ([209.132.183.28]:56957) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YT5Dr-0003iL-D0 for qemu-devel@nongnu.org; Wed, 04 Mar 2015 04:04:07 -0500 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t24945bY017021 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Wed, 4 Mar 2015 04:04:06 -0500 From: Amit Shah Date: Wed, 4 Mar 2015 14:33:56 +0530 Message-Id: <36afc0db03021aa7259dc76107e8f5bb4ae61e10.1425459836.git.amit.shah@redhat.com> Subject: [Qemu-devel] [PATCH 1/1] virtio-serial: fix segfault on NULL port names List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 Signed-off-by: Amit Shah --- 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