Fixes #26655
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/29128)
const ASN1_OBJECT *PKCS12_SAFEBAG_get0_bag_type(const PKCS12_SAFEBAG *bag)
{
+ int btype = PKCS12_SAFEBAG_get_nid(bag);
+
+ if (btype != NID_certBag && btype != NID_crlBag && btype != NID_secretBag)
+ return NULL;
return bag->value.bag->type;
}
const ASN1_TYPE *PKCS12_SAFEBAG_get0_bag_obj(const PKCS12_SAFEBAG *bag)
{
+ int vtype = PKCS12_SAFEBAG_get_bag_nid(bag);
+
+ if (vtype == -1 || vtype == NID_x509Certificate || vtype == NID_x509Crl
+ || vtype == NID_sdsiCertificate)
+ return NULL;
return bag->value.bag->value.other;
}