Skip to content

Commit

Permalink
Merge pull request #88 from italiangrid/issue-87
Browse files Browse the repository at this point in the history
Check certs for NULL before dereferencing it
  • Loading branch information
andreaceccanti authored Apr 1, 2021
2 parents 749e451 + fdbffde commit 92cbea9
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/api/ccapi/api_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,13 @@ X509 *vomsdata::check_from_file(AC *ac, std::ifstream &file, const std::string &
X509_EXTENSION *ext=sk_X509_EXTENSION_value(exts, pos);

AC_CERTS *certs = (AC_CERTS *)X509V3_EXT_d2i(ext);
STACK_OF(X509) *certstack = certs->stackcert;
STACK_OF(X509) *certstack = certs != NULL ? certs->stackcert : NULL;

if (certs == NULL || certstack == NULL) {
AC_CERTS_free(certs);
seterror(VERR_SIGN, "Malformed AC: the AC does not contain the issuer certificate chain");
return NULL;
}

bool success = false;
bool final = false;
Expand Down

0 comments on commit 92cbea9

Please sign in to comment.