]> granicus.if.org Git - openssl/commitdiff
capi_cert_get_fname: check for NULL after allocating wfname
authorJonas Maebe <jonas.maebe@elis.ugent.be>
Sun, 8 Dec 2013 22:05:23 +0000 (23:05 +0100)
committerKurt Roeckx <kurt@roeckx.be>
Thu, 4 Dec 2014 22:48:44 +0000 (23:48 +0100)
Signed-off-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Richard Levitte <levitte@openssl.org>
engines/e_capi.c

index f06d298324a6f293b500e386fb07e7ad9bea20c8..edcebf1a3f1cd5a60a0fea75735f784716f460eb 100644 (file)
@@ -1333,6 +1333,8 @@ char * capi_cert_get_fname(CAPI_CTX *ctx, PCCERT_CONTEXT cert)
        if (!CertGetCertificateContextProperty(cert, CERT_FRIENDLY_NAME_PROP_ID, NULL, &dlen))
                return NULL;
        wfname = OPENSSL_malloc(dlen);
+       if (wfname == NULL)
+               return NULL;
        if (CertGetCertificateContextProperty(cert, CERT_FRIENDLY_NAME_PROP_ID, wfname, &dlen))
                {
                char *fname = wide_to_asc(wfname);