Skip to content

Commit

Permalink
Check if card name is null in acos atrust driver
Browse files Browse the repository at this point in the history
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().
  • Loading branch information
lewisporter authored and frankmorgner committed Jan 31, 2020
1 parent 45a77ab commit 723129b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/libopensc/card-atrust-acos.c
Expand Up @@ -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);
Expand Down

0 comments on commit 723129b

Please sign in to comment.