Skip to content

Coverity warning fixes #8907

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft

Conversation

JeremiahM37
Copy link
Contributor

Description

Potential fixes for the Coverity warnings addressed in the support ticket.

Accidentally closed last pr for the same changes and it won't let me reopen for some reason.

Fixes zd#20029

Testing

How did you test?

Checklist

  • added tests
  • updated/added doxygen
  • updated appropriate READMEs
  • Updated manual and documentation

@JeremiahM37 JeremiahM37 requested a review from dgarske June 20, 2025 20:02
Copy link
Contributor

@dgarske dgarske left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These fixes are all trying to appease a static analyzer but do not improve the code.


int ParseCertRelative(DecodedCert* cert, int type, int verify, void* cm,
WOLFSSL_LOCAL int ParseCertRelative(DecodedCert* cert, int type, int verify, void* cm,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be in the header, not the .c file.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure the header and .c definitions match. Remove the comment.

src/tls.c Outdated
@@ -9384,8 +9384,9 @@ static int TLSX_KeyShare_ProcessEcc_ex(WOLFSSL* ssl,
break;
#endif
default:
/* unsupported curve */
curveId = ECC_CURVE_INVALID;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert this. The curveId not used can just be solved with the (void)curveId below.

@@ -830,7 +830,10 @@ int wc_d2i_PKCS12_fp(const char* file, WC_PKCS12** pkcs12)
wc_PKCS12_free(*pkcs12);
*pkcs12 = NULL;
}
XFREE(buf, NULL, DYNAMIC_TYPE_TMP_BUFFER);
if (buf != NULL) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

XFREE already checks NULL. Just add the buf = NULL;

@JeremiahM37 JeremiahM37 marked this pull request as draft June 20, 2025 20:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants