]> git.proxmox.com Git - qemu.git/commitdiff
ccid-card-emul: do not crash if backend is not provided
authorMarc-André Lureau <mlureau@redhat.com>
Wed, 21 Nov 2012 13:16:08 +0000 (14:16 +0100)
committerAlon Levy <alevy@redhat.com>
Wed, 24 Apr 2013 08:47:32 +0000 (11:47 +0300)
Program received signal SIGSEGV, Segmentation fault.
__strcmp_sse42 () at ../sysdeps/x86_64/multiarch/strcmp-sse42.S:164
164               movdqu        (%rsi), %xmm2
(gdb) bt
    at /home/elmarco/320g/src/qemu/hw/ccid-card-emulated.c:477
    at /home/elmarco/320g/src/qemu/hw/ccid-card-emulated.c:503

Signed-off-by: Marc-André Lureau <mlureau@redhat.com>
Reviewed-by: Alon Levy <alevy@redhat.com>
hw/usb/ccid-card-emulated.c

index d534c94c1af4015a8e5ac0e628bdf3cd29018e22..6cbb1766abb49f1a02959bd24854702a007f9e55 100644 (file)
@@ -473,6 +473,9 @@ static uint32_t parse_enumeration(char *str,
 {
     uint32_t ret = not_found_value;
 
+    if (str == NULL)
+        return 0;
+
     while (table->name != NULL) {
         if (strcmp(table->name, str) == 0) {
             ret = table->value;