Skip to content

Commit

Permalink
Add check for the optional member app, fix OpenSC#3084
Browse files Browse the repository at this point in the history
  • Loading branch information
jozsefd authored and xhanulik committed Apr 4, 2024
1 parent 2b5f3b1 commit 6bad814
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/minidriver/minidriver.c
Original file line number Diff line number Diff line change
Expand Up @@ -513,9 +513,12 @@ get_pin_by_name(PCARD_DATA pCardData, struct sc_pkcs15_card *p15card, int role,
if (!conf_block)
MD_FUNC_RETURN(pCardData, 1, SCARD_F_INTERNAL_ERROR);

memset(str_path, 0, sizeof(str_path));
sc_bin_to_hex(p15card->app->path.value, p15card->app->path.len, str_path, sizeof(str_path), 0);
blocks = scconf_find_blocks(p15card->card->ctx->conf, conf_block, "application", str_path);
if ( p15card->app != NULL ) {
memset(str_path, 0, sizeof(str_path));
sc_bin_to_hex(p15card->app->path.value, p15card->app->path.len, str_path, sizeof(str_path), 0);
blocks = scconf_find_blocks(p15card->card->ctx->conf, conf_block, "application", str_path);
}

if (blocks) {
if (blocks[0]) {
pin = (char *)scconf_get_str(blocks[0], pin_type, NULL);
Expand Down

0 comments on commit 6bad814

Please sign in to comment.