Skip to content

Fix: F-12562 - #11935

Draft
ohki-saito wants to merge 1 commit into
wolfSSL:masterfrom
ohki-saito:fix/F12562
Draft

ohki-saito wants to merge 1 commit into
wolfSSL:masterfrom
ohki-saito:fix/F12562

Conversation

@ohki-saito

Copy link
Copy Markdown
Contributor

Description

Fenrir Finding F-12562

wolfSSL_OCSP_id_get0_info() returns the elements of an OCSP_CERTID. Each call with a serial pointer allocated a new ASN1_INTEGER and stored it in cid->status->serialInt, overwriting the previous one without freeing it. Calling the function more than once with the same cid therefore leaked memory, because only the last allocation is freed with the cid.

This change returns the cached serialInt when it is already set, and only creates a new one on the first call.

Testing

Added a test to test_wolfSSL_OCSP_id_get0_info: calling OCSP_id_get0_info() twice with the same cid must return the same ASN1_INTEGER pointer. Without the fix, the second call returns a newly allocated object and the test fails.

Checklist

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

Copilot AI balanced review requested due to automatic review settings October 30, 2026 06:35
@wolfSSL-Bot

Copy link
Copy Markdown

Can one of the admins verify this patch?

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The serial-number caching change has no active review issues.

No open issues 🎉

What changed in this PR

Fixes F-12562, a memory leak in wolfSSL’s OpenSSL-compatible wolfSSL_OCSP_id_get0_info() when repeatedly requesting the serial number from the same OCSP_CERTID.

Changes:

  • Reuses the cached ASN1_INTEGER, allocating it only on the first request.
  • Adds a regression assertion that repeated calls return the same serial-number pointer.
File Description
tests/​api.c Verifies repeated calls return the cached serial-number pointer.
src/​ocsp.c Reuses serialInt instead of overwriting it with a new allocation.

Review effort: Balanced

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.

3 participants