Skip to contentSkip to conversation

ccid-card-emulated: handle no backend (fixes segfault)

PATCH In review Alon Levy 2 participants 2 messages May 17, 2011 – May 25, 2011

lore
Share & tools
lore

Alon Levy

author
#0 lore raw

PATCH 1/1 ccid-card-emulated: handle no backend (fixes segfault)

During initialization if no "backend=something" attribute is supplied don't try to call strcmp with second argument being NULL.

---
 hw/ccid-card-emulated.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
hw/ccid-card-emulated.c +3 -0
index 0b07184..ba56dca 100644
@@ -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;
Signature · 1 line
1.7.5.1