diff --git a/src/bio.c b/src/bio.c index 16b099eca..2c7f037cf 100644 --- a/src/bio.c +++ b/src/bio.c @@ -134,7 +134,7 @@ static int wolfSSL_BIO_SSL_read(WOLFSSL_BIO* bio, void* buf, WOLFSSL_ENTER("wolfSSL_BIO_SSL_write"); /* already got eof, again is error */ - if (bio && front->eof) + if (front->eof) return WOLFSSL_FATAL_ERROR; ret = wolfSSL_read(bio->ssl, buf, len); diff --git a/src/crl.c b/src/crl.c index 42e3e50e2..fd7a2e99b 100644 --- a/src/crl.c +++ b/src/crl.c @@ -247,6 +247,8 @@ static int CheckCertCRLList(WOLFSSL_CRL* crl, DecodedCert* cert, int *pFoundEntr ca = GetCA(crl->cm, issuerHash); #endif /* NO_SKID */ if (ca == NULL) { + XFREE(sig, crl->heap, DYNAMIC_TYPE_CRL_ENTRY); + XFREE(tbs, crl->heap, DYNAMIC_TYPE_CRL_ENTRY); WOLFSSL_MSG("Did NOT find CRL issuer CA"); return ASN_CRL_NO_SIGNER_E; } diff --git a/src/internal.c b/src/internal.c index 78bb88799..422c1de12 100644 --- a/src/internal.c +++ b/src/internal.c @@ -11744,10 +11744,10 @@ static INLINE void RmdRounds(int rounds, const byte* data, int sz) RipeMd ripemd; int i; - wc_InitRipeMd(&ripemd); + (void)wc_InitRipeMd(&ripemd); for (i = 0; i < rounds; i++) - wc_RipeMdUpdate(&ripemd, data, sz); + (void)wc_RipeMdUpdate(&ripemd, data, sz); } #endif @@ -14681,11 +14681,13 @@ int SendAlert(WOLFSSL* ssl, int severity, int type) if ((ret = CheckAvailableSize(ssl, outputSz)) != 0) return ret; + /* Check output buffer */ + if (ssl->buffers.outputBuffer.buffer == NULL) + return BUFFER_E; + /* get output buffer */ output = ssl->buffers.outputBuffer.buffer + ssl->buffers.outputBuffer.length; - if (output == NULL) - return BUFFER_E; input[0] = (byte)severity; input[1] = (byte)type; @@ -18380,7 +18382,7 @@ static int DoServerKeyExchange(WOLFSSL* ssl, const byte* input, #endif if (ssl->peerEccKey == NULL) { - AllocKey(ssl, DYNAMIC_TYPE_ECC, + ret = AllocKey(ssl, DYNAMIC_TYPE_ECC, (void**)&ssl->peerEccKey); if (ret != 0) { goto exit_dske; diff --git a/src/ocsp.c b/src/ocsp.c index e7bb54290..c5d672b69 100644 --- a/src/ocsp.c +++ b/src/ocsp.c @@ -651,9 +651,10 @@ OcspResponse* wolfSSL_d2i_OCSP_RESPONSE_bio(WOLFSSL_BIO* bio, l = XFTELL(bio->file); if (l < 0) return NULL; - XFSEEK(bio->file, i, SEEK_SET); + if (XFSEEK(bio->file, i, SEEK_SET) != 0) + return NULL; - /* check calulated length */ + /* check calculated length */ if (l - i <= 0) return NULL; diff --git a/src/ssl.c b/src/ssl.c index d01670578..421491297 100644 --- a/src/ssl.c +++ b/src/ssl.c @@ -29186,11 +29186,13 @@ void* wolfSSL_GetDhAgreeCtx(WOLFSSL* ssl) i = XFTELL(bp->file); if (i < 0) return NULL; - XFSEEK(bp->file, 0, SEEK_END); + if (XFSEEK(bp->file, 0, SEEK_END) != 0) + return NULL; l = XFTELL(bp->file); if (l < 0) return NULL; - XFSEEK(bp->file, i, SEEK_SET); + if (XFSEEK(bp->file, i, SEEK_SET) != 0) + return NULL; #else WOLFSSL_MSG("Unable to read file with NO_FILESYSTEM defined"); return NULL;