From 09a7a087a2224c297d931ecfcb91c867e0ad820a Mon Sep 17 00:00:00 2001 From: John Safranek Date: Tue, 29 Apr 2014 14:52:42 -0700 Subject: [PATCH] fix static analysis warnings --- ctaocrypt/src/ecc.c | 3 +++ src/ssl.c | 3 +-- src/tls.c | 3 +++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ctaocrypt/src/ecc.c b/ctaocrypt/src/ecc.c index 055f639b2..6d6da7346 100644 --- a/ctaocrypt/src/ecc.c +++ b/ctaocrypt/src/ecc.c @@ -1299,6 +1299,9 @@ int ecc_make_key(RNG* rng, int keysize, ecc_key* key) { int x, err; + if (key == NULL || rng == NULL) + return ECC_BAD_ARG_E; + /* find key size */ for (x = 0; (keysize > ecc_sets[x].size) && (ecc_sets[x].size != 0); x++) ; diff --git a/src/ssl.c b/src/ssl.c index bd54d7fda..87be69cb7 100644 --- a/src/ssl.c +++ b/src/ssl.c @@ -2036,7 +2036,6 @@ int CyaSSL_Init(void) XFREE(der.buffer, heap, dynamicType); return ret; } - ret = 0; /* back to good status */ if (XSTRNCMP(info.name, "DES-CBC", 7) == 0) { Des enc; @@ -7823,7 +7822,7 @@ int CyaSSL_set_compression(CYASSL* ssl) break; } - if (buf != NULL) { + if (buf != NULL && text != NULL) { textSz = min(textSz, len); XMEMCPY(buf, text, textSz); buf[textSz] = '\0'; diff --git a/src/tls.c b/src/tls.c index c03d8f45d..420ea15ba 100644 --- a/src/tls.c +++ b/src/tls.c @@ -550,6 +550,9 @@ int TLS_hmac(CYASSL* ssl, byte* digest, const byte* in, word32 sz, Hmac hmac; int ret; byte myInner[CYASSL_TLS_HMAC_INNER_SZ]; + + if (ssl == NULL) + return BAD_FUNC_ARG; CyaSSL_SetTlsHmacInner(ssl, myInner, sz, content, verify);