Merge pull request #744 from JacobBarthelmeh/Testing

static analysis fixes for memory management and possible null dereference
This commit is contained in:
toddouska
2017-02-09 10:18:26 -08:00
committed by GitHub
2 changed files with 12 additions and 3 deletions

View File

@@ -7594,7 +7594,9 @@ int wolfSSL_DTLS_SetCookieSecret(WOLFSSL* ssl,
#else
m = wolfSSLv23_server_method();
#endif
m->side = WOLFSSL_NEITHER_END;
if (m != NULL) {
m->side = WOLFSSL_NEITHER_END;
}
return m;
}
@@ -16629,8 +16631,14 @@ WOLFSSL_DH *wolfSSL_DSA_dup_DH(const WOLFSSL_DSA *dsa)
WOLFSSL_DH* dh;
DhKey* key;
WOLFSSL_ENTER("wolfSSL_DSA_dup_DH");
if (dsa == NULL) {
return NULL;
}
dh = wolfSSL_DH_new();
if (dh == NULL || dsa == NULL) {
if (dh == NULL) {
return NULL;
}
key = (DhKey*)dh->internal;

View File

@@ -310,7 +310,8 @@ int wc_SrpSetParams(Srp* srp, const byte* N, word32 nSz,
byte digest1[SRP_MAX_DIGEST_SIZE];
byte digest2[SRP_MAX_DIGEST_SIZE];
byte pad = 0;
int i, j, r;
int i, r;
int j = 0;
if (!srp || !N || !g || !salt || nSz < gSz)
return BAD_FUNC_ARG;