Merge pull request #331 from kaleb-himes/CID-66006-coverity

Move assignment to after the null check
This commit is contained in:
dgarske
2016-03-02 15:23:58 -08:00

View File

@@ -1763,13 +1763,15 @@ int SetSSL_CTX(WOLFSSL* ssl, WOLFSSL_CTX* ctx)
{
byte havePSK = 0;
byte haveAnon = 0;
byte newSSL;
byte haveRSA = 0;
byte newSSL = ssl->ctx == NULL;
(void) haveAnon; /* Squash unused var warnings */
if(!ssl || !ctx || ssl->suites == NULL)
return BAD_FUNC_ARG;
newSSL = ssl->ctx == NULL; /* Assign after null check */
#ifndef NO_PSK
if (ctx->server_hint[0] && ssl->arrays == NULL) {
return BAD_FUNC_ARG; /* needed for copy below */