Commit 903738ac authored by Matt Caswell's avatar Matt Caswell
Browse files

Fix missing malloc return value checks



During work on a larger change in master a number of locations were
identified where return value checks were missing. This backports the
relevant fixes.

Reviewed-by: default avatarRichard Levitte <levitte@openssl.org>
parent a89dda8c
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -2532,6 +2532,8 @@ static int do_updatedb(CA_DB *db)
    char **rrow, *a_tm_s;

    a_tm = ASN1_UTCTIME_new();
    if (a_tm == NULL)
        return -1;

    /* get actual time and make a string */
    a_tm = X509_gmtime_adj(a_tm, 0);
+3 −0
Original line number Diff line number Diff line
@@ -121,6 +121,9 @@ CMS_RecipientInfo *CMS_add0_recipient_password(CMS_ContentInfo *cms,

    /* Setup algorithm identifier for cipher */
    encalg = X509_ALGOR_new();
    if (encalg == NULL) {
        goto merr;
    }
    EVP_CIPHER_CTX_init(&ctx);

    if (EVP_EncryptInit_ex(&ctx, kekciph, NULL, NULL, NULL) <= 0) {
+2 −0
Original line number Diff line number Diff line
@@ -857,6 +857,8 @@ int CMS_SignerInfo_verify_content(CMS_SignerInfo *si, BIO *chain)
    } else {
        const EVP_MD *md = EVP_MD_CTX_md(&mctx);
        pkctx = EVP_PKEY_CTX_new(si->pkey, NULL);
        if (pkctx == NULL)
            goto err;
        if (EVP_PKEY_verify_init(pkctx) <= 0)
            goto err;
        if (EVP_PKEY_CTX_set_signature_md(pkctx, md) <= 0)
+5 −2
Original line number Diff line number Diff line
@@ -1292,15 +1292,18 @@ static DSA_SIG *cryptodev_dsa_do_sign(const unsigned char *dgst, int dlen,
    if (cryptodev_asym(&kop, BN_num_bytes(dsa->q), r,
                       BN_num_bytes(dsa->q), s) == 0) {
        dsaret = DSA_SIG_new();
        if (dsaret == NULL)
            goto err;
        dsaret->r = r;
        dsaret->s = s;
        r = s = NULL;
    } else {
        const DSA_METHOD *meth = DSA_OpenSSL();
        BN_free(r);
        BN_free(s);
        dsaret = (meth->dsa_do_sign) (dgst, dlen, dsa);
    }
 err:
    BN_free(r);
    BN_free(s);
    kop.crk_param[0].crp_p = NULL;
    zapparams(&kop);
    return (dsaret);
+2 −0
Original line number Diff line number Diff line
@@ -104,6 +104,8 @@ int EVP_read_pw_string_min(char *buf, int min, int len, const char *prompt,
    if ((prompt == NULL) && (prompt_string[0] != '\0'))
        prompt = prompt_string;
    ui = UI_new();
    if (ui == NULL)
        return -1;
    UI_add_input_string(ui, prompt, 0, buf, min,
                        (len >= BUFSIZ) ? BUFSIZ - 1 : len);
    if (verify)
Loading