From 75c14ce815e76980e93fb8a80520dbef5fc5e7a0 Mon Sep 17 00:00:00 2001 From: Frank Morgner Date: Thu, 14 Jan 2016 05:02:28 +0100 Subject: [PATCH] Fixed possible NULL dereference fixes https://github.com/OpenSC/OpenSC/issues/656 --- src/libopensc/pkcs15.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libopensc/pkcs15.c b/src/libopensc/pkcs15.c index 5906621a..a515cea6 100644 --- a/src/libopensc/pkcs15.c +++ b/src/libopensc/pkcs15.c @@ -421,12 +421,12 @@ fix_starcos_pkcs15_card(struct sc_pkcs15_card *p15card) struct sc_context *ctx = p15card->card->ctx; /* set special flags based on card meta data */ - if (strcmp(p15card->card->driver->short_name,"cardos") == 0) { + if (strcmp(p15card->card->driver->short_name,"cardos") == 0 + && p15card->tokeninfo && p15card->tokeninfo->label) { /* D-Trust cards (D-TRUST, D-SIGN) */ - if (p15card->tokeninfo->label - && (strstr(p15card->tokeninfo->label,"D-TRUST") != NULL - || strstr(p15card->tokeninfo->label,"D-SIGN") != NULL)) { + if (strstr(p15card->tokeninfo->label,"D-TRUST") != NULL + || strstr(p15card->tokeninfo->label,"D-SIGN") != NULL) { /* D-TRUST Card 2.0 2cc (standard cards, which always add * SHA1 prefix itself */