Fix base64 decoding bug.
[oweals/openssl.git] / crypto / pem / pem_info.c
index 7382b61995c4a3a2c570448461559d78227b1ac3..cc7f24a9c1cf491ae3092b9dc4aa8fe05e927ef0 100644 (file)
@@ -167,6 +167,7 @@ start:
 #ifndef OPENSSL_NO_RSA
                        if (strcmp(name,PEM_STRING_RSA) == 0)
                        {
+                       d2i=(D2I_OF(void))d2i_RSAPrivateKey;
                        if (xi->x_pkey != NULL) 
                                {
                                if (!sk_X509_INFO_push(ret,xi)) goto err;
@@ -339,6 +340,12 @@ int PEM_X509_INFO_write_bio(BIO *bp, X509_INFO *xi, EVP_CIPHER *enc,
                {
                if ( (xi->enc_data!=NULL) && (xi->enc_len>0) )
                        {
+                       if (enc == NULL)
+                               {
+                               PEMerr(PEM_F_PEM_X509_INFO_WRITE_BIO,PEM_R_CIPHER_IS_NULL);
+                               goto err;
+                               }
+
                        /* copy from weirdo names into more normal things */
                        iv=xi->enc_cipher.iv;
                        data=(unsigned char *)xi->enc_data;