Merge pull request #7717 from JacobBarthelmeh/coverity

Some additional Coverity touch ups
This commit is contained in:
David Garske
2024-07-05 15:49:53 -07:00
committed by GitHub
3 changed files with 8 additions and 1 deletions

View File

@@ -247,6 +247,11 @@ static int wolfssl_i2d_asn1_item(void** item, int type, byte* buf)
len = 0;
}
if (len < 0) {
len = 0; /* wolfSSL_i2d_ASN1_INTEGER can return a value less than 0
* on error */
}
return len;
}

View File

@@ -65656,7 +65656,7 @@ static int test_EccSigFailure_cm(void)
size_t cert_sz = 0;
ExpectIntEQ(load_file(server_cert, &cert_buf, &cert_sz), 0);
if (cert_buf != NULL) {
if (cert_buf != NULL && cert_sz > 0) {
/* corrupt DER - invert last byte, which is signature */
cert_buf[cert_sz-1] = ~cert_buf[cert_sz-1];

View File

@@ -3283,6 +3283,8 @@ int wolfSSL_EVP_PKEY_bits(const WOLFSSL_EVP_PKEY *pkey)
if (pkey == NULL) return 0;
WOLFSSL_ENTER("wolfSSL_EVP_PKEY_bits");
if ((bytes = wolfSSL_EVP_PKEY_size((WOLFSSL_EVP_PKEY*)pkey)) ==0) return 0;
if (bytes < 0)
return 0;
return bytes*8;
}