From 0e67cd17d6ca9f078cabb4bf8ee05a7d03ae4122 Mon Sep 17 00:00:00 2001 From: toddouska Date: Wed, 12 Dec 2012 20:04:10 -0800 Subject: [PATCH] clang opensslExtra fix --- src/ssl.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/ssl.c b/src/ssl.c index 7ae07fb72..1baa80dab 100644 --- a/src/ssl.c +++ b/src/ssl.c @@ -1260,7 +1260,7 @@ int CyaSSL_Init(void) byte key[AES_256_KEY_SIZE]; byte iv[AES_IV_SIZE]; - if (!ctx->passwd_cb) { + if (!ctx || !ctx->passwd_cb) { XFREE(der.buffer, heap, dynamicType); return NO_PASSWORD; } @@ -1311,9 +1311,15 @@ int CyaSSL_Init(void) } #endif /* OPENSSL_EXTRA || HAVE_WEBSERVER */ - if (type == CA_TYPE) + if (type == CA_TYPE) { + if (ctx == NULL) { + CYASSL_MSG("Need context for CA load"); + XFREE(der.buffer, heap, dynamicType); + return BAD_FUNC_ARG; + } return AddCA(ctx->cm, der, CYASSL_USER_CA, ctx->verifyPeer); /* takes der over */ + } else if (type == CERT_TYPE) { if (ssl) { if (ssl->buffers.weOwnCert && ssl->buffers.certificate.buffer)