diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2011-05-15 13:44:14 +0200 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2011-05-15 13:44:14 +0200 |
commit | 9609ea869dde4d74a610a62ccaee448b0ac8082b (patch) | |
tree | 0869054284d8afa164ccfcf5f9f2a0d8ff9b8335 /engines | |
parent | Typo. (diff) | |
download | openssl-9609ea869dde4d74a610a62ccaee448b0ac8082b.tar.xz openssl-9609ea869dde4d74a610a62ccaee448b0ac8082b.zip |
NULL is a valid cspname
Diffstat (limited to 'engines')
-rw-r--r-- | engines/e_capi.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/engines/e_capi.c b/engines/e_capi.c index d4cfdfe4ec..ce1bec906a 100644 --- a/engines/e_capi.c +++ b/engines/e_capi.c @@ -1158,17 +1158,23 @@ static int capi_list_containers(CAPI_CTX *ctx, BIO *out) LPTSTR cspname = NULL; CAPI_trace(ctx, "Listing containers CSP=%s, type = %d\n", ctx->cspname, ctx->csptype); - if (sizeof(TCHAR)!=sizeof(char)) + if (ctx->cspname && sizeof(TCHAR)!=sizeof(char)) { if ((clen=MultiByteToWideChar(CP_ACP,0,ctx->cspname,-1,NULL,0))) { cspname = alloca(clen*sizeof(WCHAR)); MultiByteToWideChar(CP_ACP,0,ctx->cspname,-1,(WCHAR *)cspname,clen); } + if (!cspname) + { + CAPIerr(CAPI_F_CAPI_LIST_CONTAINERS, ERR_R_MALLOC_FAILURE); + capi_addlasterror(); + return 0; + } } else cspname = (TCHAR *)ctx->cspname; - if (!cspname || !CryptAcquireContext(&hprov, NULL, cspname, ctx->csptype, CRYPT_VERIFYCONTEXT)) + if (!CryptAcquireContext(&hprov, NULL, cspname, ctx->csptype, CRYPT_VERIFYCONTEXT)) { CAPIerr(CAPI_F_CAPI_LIST_CONTAINERS, CAPI_R_CRYPTACQUIRECONTEXT_ERROR); capi_addlasterror(); |