Fix for BIO pairs.
[openssl.git] / crypto / pkcs12 / p12_crpt.c
index ae516eeb8da94b9e2062b7ece150d082d623698f..d94265403afd7350551cbaf584a148f778565f97 100644 (file)
@@ -92,8 +92,8 @@ int PKCS12_PBE_keyivgen (EVP_CIPHER_CTX *ctx, const char *pass, int passlen,
 
        /* Extract useful info from parameter */
        pbuf = param->value.sequence->data;
-       if (!(pbe = d2i_PBEPARAM (NULL, &pbuf,
-                                       param->value.sequence->length))) {
+       if (!param || (param->type = V_ASN1_SEQUENCE) ||
+          !(pbe = d2i_PBEPARAM (NULL, &pbuf, param->value.sequence->length))) {
                EVPerr(PKCS12_F_PKCS12_PBE_KEYIVGEN,EVP_R_DECODE_ERROR);
                return 0;
        }