Skip to content

F-3312 added condition to handle empty string as null ptr explicitly#232

Merged
cconlon merged 1 commit into
wolfSSL:mainfrom
aidankeefe2022:fix-out-of-bound-read
May 29, 2026
Merged

F-3312 added condition to handle empty string as null ptr explicitly#232
cconlon merged 1 commit into
wolfSSL:mainfrom
aidankeefe2022:fix-out-of-bound-read

Conversation

@aidankeefe2022
Copy link
Copy Markdown
Member

added check to prevent out of bounds read of the outDir field later in the function that could occur on line 1121 in the wolfCLU_CertSignAppendOut function. The out of bounds read could have occured before this fix an empty string was passed and the string was accessed at the -1 index.

Copy link
Copy Markdown

@wolfSSL-Fenrir-bot wolfSSL-Fenrir-bot left a comment

Choose a reason for hiding this comment

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

Fenrir Automated Review — PR #232

Scan targets checked: wolfclu-bugs, wolfclu-src

No new issues found in the changed files. ✅

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes an out-of-bounds read in wolfCLU_CertSignAppendOut that occurred when csign->outDir was set to an empty string. In that case, the relative-path branch later indexed csign->outDir[currentSz - 1] with currentSz == 0, reading outDir[-1]. The fix treats an empty outDir as if it were NULL by freeing it and resetting the pointer.

Changes:

  • Treat an empty csign->outDir as NULL by calling wolfCLU_CertSignSetOut(csign, NULL) early in the function.
  • Initialize outSz to 0 at declaration.
  • Minor whitespace edits (removed a blank comment line in the license header; added two blank lines between case 1 and case 2 blocks).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/x509/clu_x509_sign.c Outdated
Comment thread src/x509/clu_x509_sign.c Outdated
@cconlon
Copy link
Copy Markdown
Member

cconlon commented May 28, 2026

@aidankeefe2022 see new copilot comments above, thanks

@cconlon cconlon assigned aidankeefe2022 and unassigned cconlon May 28, 2026
…and initialized function variable to avoid possible future UB. And fix formatting
Copy link
Copy Markdown

@wolfSSL-Fenrir-bot wolfSSL-Fenrir-bot left a comment

Choose a reason for hiding this comment

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

Fenrir Automated Review — PR #232

Scan targets checked: wolfclu-bugs, wolfclu-src

No new issues found in the changed files. ✅

@cconlon cconlon merged commit f642afc into wolfSSL:main May 29, 2026
27 checks passed
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.

5 participants