Coverity scan fixes

This commit is contained in:
J Harper
2016-05-03 23:31:53 -07:00
parent 464b9af227
commit 5ca20e16b2
8 changed files with 46 additions and 29 deletions

View File

@@ -1394,10 +1394,11 @@ int32 parseServerHello(ssl_t *ssl, int32 hsLen, unsigned char **cp,
ssl->err = SSL_ALERT_PROTOCOL_VERSION;
psTraceInfo("Server wants to talk TLS1.0 but it's disabled\n");
return MATRIXSSL_ERROR;
#endif
#else
ssl->reqMinVer = ssl->minVer;
ssl->minVer = TLS_MIN_VER;
ssl->flags &= ~SSL_FLAGS_TLS_1_1;
#endif
} else {
#endif/* USE_TLS_1_1 */
#ifdef USE_DTLS

View File

@@ -757,7 +757,7 @@ ADVANCE_TO_APP_DATA:
for (rc = (256 - padLen) - 1; rc > 0; rc--) {
/* make this test look like the others */
if ((unsigned char)rc == padLen) {
/* coverity[unused_value] */
/* coverity[assigned_value] */
macError = 1; /* not really an error. reset below */
}
}

View File

@@ -1281,17 +1281,17 @@ LBL_FREE:
} /* End version loop (unindented) */
#ifdef USE_RSA
if (spec->type == CS_RSA) {
if (spec && spec->type == CS_RSA) {
goto L_NEXT_RSA;
}
#endif
#ifdef USE_ECC
if (spec->type == CS_ECDH_ECDSA || spec->type == CS_ECDHE_ECDSA) {
if (spec && (spec->type == CS_ECDH_ECDSA || spec->type == CS_ECDHE_ECDSA)) {
goto L_NEXT_ECC;
}
#endif
#ifdef REQUIRE_DH_PARAMS
if (spec->type == CS_DHE_RSA || spec->type == CS_DHE_PSK) {
if (spec && (spec->type == CS_DHE_RSA || spec->type == CS_DHE_PSK)) {
goto L_NEXT_DH;
}
#endif
@@ -1572,6 +1572,9 @@ static int32 performHandshake(sslConn_t *sendingSide, sslConn_t *receivingSide)
/*
The indata is the outdata from the sending side. copy it over
*/
if (outbufLen <= 0 || inbufLen <= 0) {
return PS_FAILURE;
}
dataSent = min(outbufLen, inbufLen);
memcpy(inbuf, outbuf, dataSent);
@@ -1746,7 +1749,7 @@ static int32_t throughputTest(sslConn_t *s, sslConn_t *r, uint16_t nrec, uint16_
s->appTime += psDiffMsecs(start, end, NULL);
len = matrixSslGetReadbufOfSize(r->ssl, buflen, &rb);
if (len < buflen) {
if (buflen <= 0 || len < buflen) {
return PS_FAIL;
}
memcpy(rb, wb, buflen);
@@ -1870,6 +1873,9 @@ SEND_MORE:
*/
inBufLen = matrixSslGetReadbuf(receivingSide->ssl, &inBuf);
if (writeBufLen <= 0 || inBufLen <= 0) {
return PS_FAILURE;
}
dataSent = min(writeBufLen, inBufLen);
memcpy(inBuf, writeBuf, dataSent);
@@ -2245,4 +2251,3 @@ static void statCback(void *ssl, void *stat_ptr, int32 type, int32 value)
#endif
/******************************************************************************/