Skip to content

Commit

Permalink
NULL-check s2n_cert_chain_and_key_get_pkey_type
Browse files Browse the repository at this point in the history
This adds a check to guard the case where a certificate chain
is empty. In case it is, S2N_PKEY_TYPE_UNKNOWN is returned.
  • Loading branch information
phillipberndt committed Sep 22, 2021
1 parent 4de98dc commit 7a63577
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions crypto/s2n_certificate.c
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,11 @@ void *s2n_cert_chain_and_key_get_ctx(struct s2n_cert_chain_and_key *cert_and_key

s2n_pkey_type s2n_cert_chain_and_key_get_pkey_type(struct s2n_cert_chain_and_key *chain_and_key)
{
if (chain_and_key == NULL
|| chain_and_key->cert_chain == NULL
|| hain_and_key->cert_chain->head == NULL) {
return S2N_PKEY_TYPE_UNKNOWN;
}
return chain_and_key->cert_chain->head->pkey_type;
}

Expand Down

0 comments on commit 7a63577

Please sign in to comment.