From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:45230) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QMH81-0000Db-CQ for qemu-devel@nongnu.org; Tue, 17 May 2011 06:03:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QMH80-0003de-Ed for qemu-devel@nongnu.org; Tue, 17 May 2011 06:03:49 -0400 Received: from mx1.redhat.com ([209.132.183.28]:2652) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QMH80-0003dB-7q for qemu-devel@nongnu.org; Tue, 17 May 2011 06:03:48 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p4HA3k1l000567 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 17 May 2011 06:03:46 -0400 Received: from playa.tlv.redhat.com (dhcp-3-110.tlv.redhat.com [10.35.3.110]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p4HA3ikb008284 for ; Tue, 17 May 2011 06:03:45 -0400 From: Alon Levy Date: Tue, 17 May 2011 13:03:42 +0300 Message-Id: <1305626622-12925-1-git-send-email-alevy@redhat.com> Subject: [Qemu-devel] [PATCH] ccid-card-emulated: handle no backend (fixes segfault) List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org During initialization if no "backend=something" attribute is supplied don't try to call strcmp with second argument being NULL. Signed-off-by: Alon Levy --- hw/ccid-card-emulated.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/hw/ccid-card-emulated.c b/hw/ccid-card-emulated.c index 0b07184..ba56dca 100644 --- a/hw/ccid-card-emulated.c +++ b/hw/ccid-card-emulated.c @@ -476,6 +476,9 @@ static uint32_t parse_enumeration(char *str, { uint32_t ret = not_found_value; + if (!str) { + return ret; + } while (table->name != NULL) { if (strcmp(table->name, str) == 0) { ret = table->value; -- 1.7.5.1