Skip to content

Commit d4242fa

Browse files
authored
Merge pull request #9272 from julek-wolfssl/cov-20251006
Handle coverity reported errors
2 parents 68eb8b7 + 32e24e8 commit d4242fa

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

src/internal.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25091,15 +25091,15 @@ int SendCertificateRequest(WOLFSSL* ssl)
2509125091
#if defined(HAVE_CERTIFICATE_STATUS_REQUEST) \
2509225092
|| defined(HAVE_CERTIFICATE_STATUS_REQUEST_V2)
2509325093
static int BuildCertificateStatus(WOLFSSL* ssl, byte type, buffer* status,
25094-
byte count)
25094+
word32 count)
2509525095
{
2509625096
byte* output = NULL;
2509725097
word32 idx = RECORD_HEADER_SZ + HANDSHAKE_HEADER_SZ;
2509825098
word32 length = ENUM_LEN;
2509925099
word32 headerSz= idx;
2510025100
int sendSz = 0;
2510125101
int ret = 0;
25102-
int i = 0;
25102+
word32 i = 0;
2510325103

2510425104
WOLFSSL_ENTER("BuildCertificateStatus");
2510525105

@@ -25178,14 +25178,14 @@ static int BuildCertificateStatusWithStatusCB(WOLFSSL* ssl, byte status_type)
2517825178
ret = ocsp->statusCb(ssl, ocsp->statusCbArg);
2517925179
switch (ret) {
2518025180
case WOLFSSL_OCSP_STATUS_CB_OK: {
25181-
byte cnt = 1;
25181+
word32 cnt = 1;
2518225182
#if defined(HAVE_CERTIFICATE_STATUS_REQUEST_V2)
2518325183
if (status_type == WOLFSSL_CSR2_OCSP_MULTI) {
2518425184
/* Find last response set */
2518525185
for (cnt = XELEM_CNT(ssl->ocspCsrResp);
2518625186
cnt > 0 && ssl->ocspCsrResp[cnt-1].buffer == NULL;
2518725187
cnt--);
25188-
cnt = MIN(cnt, ssl->buffers.certChainCnt + 1);
25188+
cnt = MIN(cnt, (word32)ssl->buffers.certChainCnt + 1);
2518925189
}
2519025190
#endif
2519125191
ret = BuildCertificateStatus(ssl, status_type, ssl->ocspCsrResp,
@@ -25286,7 +25286,7 @@ int SendCertificateStatus(WOLFSSL* ssl)
2528625286
OcspRequest* request = ssl->ctx->certOcspRequest;
2528725287
buffer responses[1 + MAX_CHAIN_DEPTH];
2528825288
byte ctxOwnsRequest = 0;
25289-
int i = 0;
25289+
word32 i = 0;
2529025290

2529125291
XMEMSET(responses, 0, sizeof(responses));
2529225292

@@ -25388,7 +25388,7 @@ int SendCertificateStatus(WOLFSSL* ssl)
2538825388
if (responses[0].buffer) {
2538925389
if (ret == 0) {
2539025390
ret = BuildCertificateStatus(ssl, status_type, responses,
25391-
(byte)i + 1);
25391+
i + 1);
2539225392
}
2539325393

2539425394
for (i = 0; i < 1 + MAX_CHAIN_DEPTH; i++) {

src/tls13.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8719,8 +8719,7 @@ static int SetupOcspResp(WOLFSSL* ssl)
87198719
extension = TLSX_Find(ssl->extensions, TLSX_STATUS_REQUEST);
87208720
if (extension == NULL)
87218721
return 0; /* peer didn't signal ocsp support */
8722-
csr = extension ?
8723-
(CertificateStatusRequest*)extension->data : NULL;
8722+
csr = (CertificateStatusRequest*)extension->data;
87248723
if (csr == NULL)
87258724
return MEMORY_ERROR;
87268725

tests/api/test_ocsp.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1007,6 +1007,7 @@ int test_ocsp_tls_cert_cb(void)
10071007
}
10081008
}
10091009
else {
1010+
/* coverity[deadcode] - skip is only set for some build configs */
10101011
printf("\tskipping test case\n");
10111012
}
10121013

0 commit comments

Comments
 (0)