Do not parse certificates with invalid version in openssl plugin

This commit is contained in:
Martin Willi
2011-01-05 16:46:01 +01:00
parent a2b340764f
commit a6850b8499
@@ -899,6 +899,13 @@ static bool parse_certificate(private_openssl_x509_t *this)
{
return FALSE;
}
if (X509_get_version(this->x509) < 0 || X509_get_version(this->x509) > 2)
{
DBG1(DBG_LIB, "unsupported x509 version: %d",
X509_get_version(this->x509) + 1);
return FALSE;
}
this->subject = openssl_x509_name2id(X509_get_subject_name(this->x509));
this->issuer = openssl_x509_name2id(X509_get_issuer_name(this->x509));