Check if card name is null in acos atrust driver

opensc-tool segfaults when trying to read a card  that doen’t populate the name field. This commit adds a null check before calling strcmp().
This commit is contained in:
Lewis Porter 2020-01-07 20:44:09 +02:00 committed by Frank Morgner
parent 45a77ab88d
commit 723129bc12
1 changed files with 1 additions and 1 deletions

View File

@ -123,7 +123,7 @@ static int atrust_acos_init(struct sc_card *card)
| SC_ALGORITHM_RSA_HASH_RIPEMD160
| SC_ALGORITHM_RSA_HASH_MD5_SHA1;
if (!strcmp(card->name, ACOS_EMV_A05))
if (card->name != NULL && !strcmp(card->name, ACOS_EMV_A05))
flags |= SC_ALGORITHM_RSA_HASH_SHA256;
_sc_card_add_rsa_alg(card, 1536, flags, 0x10001);