Fix CRL encoding bug.
[oweals/openssl.git] / crypto / asn1 / p5_pbe.c
index adb92e5fd057cb0e74968dd743f1b18a5918e716..8cda4f609a5762717b625834834e2dcf74716845 100644 (file)
@@ -129,7 +129,8 @@ X509_ALGOR *PKCS5_pbe_set(int alg, int iter, unsigned char *salt,
        }
        pbe->salt->length = saltlen;
        if (salt) memcpy (pbe->salt->data, salt, saltlen);
-       else RAND_bytes (pbe->salt->data, saltlen);
+       else if (RAND_bytes (pbe->salt->data, saltlen) <= 0)
+               return NULL;
 
        if (!(astype = ASN1_TYPE_new())) {
                ASN1err(ASN1_F_ASN1_PBE_SET,ERR_R_MALLOC_FAILURE);