Skip to contentSkip to conversation

ccid-card-emul: do not crash if backend is not provided

PATCH New Marc-André Lureau 1 participant 1 message Nov 21, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ccid-card-emul: do not crash if backend is not provided

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
---
 hw/ccid-card-emulated.c | 3 +++
 1 file changed, 3 insertions(+)
hw/ccid-card-emulated.c +3 -0
index f4a6da4..e82b72b 100644
@@ -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;
Signature · 1 line
1.7.11.7