Skip to content

Commit

Permalink
card-openpgp.c - fix invalid read found by valgrind
Browse files Browse the repository at this point in the history
 On branch X25519-improvements-2
 Changes to be committed:
	modified:   libopensc/card-openpgp.c
  • Loading branch information
dengert committed Apr 27, 2024
1 parent af63851 commit 53b43b6
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/libopensc/card-openpgp.c
Original file line number Diff line number Diff line change
Expand Up @@ -2585,10 +2585,9 @@ pgp_update_new_algo_attr(sc_card_t *card, sc_cardctl_openpgp_keygen_info_t *key_
LOG_FUNC_RETURN(card->ctx, SC_ERROR_NOT_SUPPORTED);
}

pgp_set_blob(algo_blob, data, data_len);
r = pgp_put_data(card, tag, data, data_len);
/* Note: pgp_put_data calls pgp_set_blob */
free(data);
r = pgp_put_data(card, tag, algo_blob->data, data_len);
/* Note: Don't use pgp_set_blob to set data, because it won't touch the real DO */
LOG_TEST_RET(card->ctx, r, "Cannot set new algorithm attributes");
} else {
sc_cardctl_openpgp_keygen_info_t old_key_info;
Expand Down

0 comments on commit 53b43b6

Please sign in to comment.