Skip to content

Commit

Permalink
tls: avoid a nullpointer dereference
Browse files Browse the repository at this point in the history
  * If none of the CRLs match the name and less than MAX_CRLS were loaded,
    it comes to a segmentation fault because data->crls[cnt] is null

Signed-off-by: Adrian Brzezinski <adrian.brzezinski@eo.pl>
  • Loading branch information
Adrian Brzezinski authored and franku committed Nov 5, 2019
1 parent cd43cb7 commit 1699ec9
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions core/src/lib/tls_openssl_crl.cc
Expand Up @@ -293,6 +293,9 @@ static int CrlReloaderGetBySubject(X509_LOOKUP *lookup, int type, X509_NAME *nam
ret->type = 0;
ret->data.crl = NULL;
for (cnt = 0; cnt < MAX_CRLS; cnt++) {

if ( data->crls[cnt] == NULL ) { continue; }

if (CrlEntryExpired(data->crls[cnt]) && !CrlReloaderReloadIfNewer(lookup)) {
goto bail_out;
}
Expand Down

0 comments on commit 1699ec9

Please sign in to comment.