Skip to content

Commit

Permalink
pkcs15init/pkcs15-openpgp.c - fix up problem reported in github
Browse files Browse the repository at this point in the history
  • Loading branch information
dengert committed Sep 8, 2024
1 parent e527a6a commit e115540
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/pkcs15init/pkcs15-openpgp.c
Original file line number Diff line number Diff line change
Expand Up @@ -339,8 +339,10 @@ static int openpgp_generate_key_ec(sc_card_t *card, sc_pkcs15_object_t *obj,
pubkey->algorithm = key_info.key_type;
pubkey->u.ec.ecpointQ.len = key_info.u.ec.ecpoint_len;
pubkey->u.ec.ecpointQ.value = malloc(key_info.u.ec.ecpoint_len);
if (pubkey->u.ec.ecpointQ.value == NULL)
LOG_FUNC_RETURN(ctx, SC_ERROR_NOT_ENOUGH_MEMORY);
if (pubkey->u.ec.ecpointQ.value == NULL) {
r = SC_ERROR_NOT_ENOUGH_MEMORY;
goto err;
}

memcpy(pubkey->u.ec.ecpointQ.value, key_info.u.ec.ecpoint, key_info.u.ec.ecpoint_len);

Expand Down

0 comments on commit e115540

Please sign in to comment.