OpenPGP: improve get_full_pgp_aid()'s parameter checking

This commit is contained in:
Peter Marschall 2018-06-16 19:34:39 +02:00 committed by Frank Morgner
parent 2a7a6a62fa
commit 2e1b47a79a
1 changed files with 7 additions and 4 deletions

View File

@ -364,10 +364,13 @@ struct pgp_priv_data {
static int
get_full_pgp_aid(sc_card_t *card, sc_file_t *file)
{
int r = 0;
/* explicitly get the full aid */
r = sc_get_data(card, 0x004F, file->name, sizeof file->name);
file->namelen = MAX(r, 0);
int r = SC_ERROR_INVALID_ARGUMENTS;
if (file != NULL) {
/* explicitly get the full aid */
r = sc_get_data(card, 0x004F, file->name, sizeof file->name);
file->namelen = MAX(r, 0);
}
return r;
}