Skip to content

Add check for all zeros in CreateMpint#939

Merged
ejohnstown merged 1 commit intowolfSSL:masterfrom
padelsbach:mpint-all-zero-buf
Apr 21, 2026
Merged

Add check for all zeros in CreateMpint#939
ejohnstown merged 1 commit intowolfSSL:masterfrom
padelsbach:mpint-all-zero-buf

Conversation

@padelsbach
Copy link
Copy Markdown
Contributor

Defensive check for a fully zeroed buffer. No test infrastructure for this type of internal API.

Fixes F-2477.

@padelsbach padelsbach marked this pull request as ready for review April 21, 2026 03:44
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 #939

Scan targets checked: wolfssh-bugs, wolfssh-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

This PR adds a defensive guard in CreateMpint() to correctly handle the edge case where the input buffer is fully zeroed, aligning mpint encoding with RFC 4251 and avoiding invalid access.

Changes:

  • Detects the “all bytes are 0x00” case after trimming leading zeros.
  • Normalizes that case to an empty mpint (sz = 0, pad = 0) and returns success.

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

@ejohnstown ejohnstown merged commit 0d283d2 into wolfSSL:master Apr 21, 2026
135 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.

4 participants