From 860732276595f8763b3dfced95476559793c2072 Mon Sep 17 00:00:00 2001 From: Jonas Maebe Date: Sun, 8 Dec 2013 23:05:23 +0100 Subject: [PATCH] capi_cert_get_fname: check for NULL after allocating wfname Signed-off-by: Kurt Roeckx Reviewed-by: Richard Levitte --- engines/e_capi.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/engines/e_capi.c b/engines/e_capi.c index f06d298324..edcebf1a3f 100644 --- a/engines/e_capi.c +++ b/engines/e_capi.c @@ -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); -- GitLab