Fixes from CodeSonar report#8700
Merged
JacobBarthelmeh merged 1 commit intowolfSSL:masterfrom Apr 23, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This pull request implements several fixes identified by the CodeSonar report across cryptography and SSL/TLS-related modules. Key changes include improving memory initialization, replacing unsafe memory operations, and consistently nullifying pointers after freeing them to prevent use‑after‑free issues.
Reviewed Changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| wolfcrypt/src/wc_port.c | Removed duplicate XMEMSET by conditionally initializing ctx. |
| wolfcrypt/src/rsa.c | Introduced local variable “digSz” and enhanced hash digest error checking. |
| wolfcrypt/src/pkcs12.c | Ensured variable “size” is explicitly initialized to zero. |
| wolfcrypt/src/evp.c | Replaced XMEMCPY with XMEMMOVE to safely copy possibly overlapping buffers. |
| wolfcrypt/src/cpuid.c | Fully initialized the “reg” array using XMEMSET instead of a single element assignment. |
| wolfcrypt/src/asn.c | Added zero‐initialization of “pubKey” before key decoding functions. |
| src/x509_str.c | Set pointers to NULL consistently after freeing to improve safety. |
| ... (additional files) | Similar pointer nullification and error checking improvements. |
Comments suppressed due to low confidence (1)
wolfcrypt/src/rsa.c:4066
- Introducing a dedicated 'digSz' variable along with an additional check (digSz < 0) improves the robustness of hash digest size verification. Ensure that wc_HashGetDigestSize can return negative values in error conditions.
int digSz;
Member
Author
|
Retest this please: |
JacobBarthelmeh
approved these changes
Apr 23, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Testing
CI + CodeSonar validation
Checklist