Skip to content

Fix: Fenrir F-12569 - #11955

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

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

Conversation

@ohki-saito

Copy link
Copy Markdown
Contributor

Description

Fenrir Finding F-12569

wolfSSL_PKCS12_parse() ignored a ParseCertRelative() failure for the main certificate and returned success with a partially decoded X509. It now returns an error, as the CA certificate path already does. This failure is reachable through an allocation failure.

Testing

Added test_wolfSSL_PKCS12_parse_main_cert_oom, which fails each allocation in turn and checks that any returned certificate has a public key.

Checklist

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

Copilot AI balanced review requested due to automatic review settings November 2, 2026 10:57
@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.

🟡 Changes recommended

The fault-injection callbacks allocate pkey and cert with raw malloc, but restoring the tracked allocator causes incompatible frees and invalid memory access in WOLFSSL_TRACK_MEMORY builds.

1 open issue
What changed in this PR

Addresses Fenrir F-12569 by making wolfSSL_PKCS12_parse() report main-certificate parsing failures instead of returning success with a partially decoded X509.

Changes:

  • Routes main-certificate parsing errors through existing cleanup logic.
  • Adds and registers an allocation-failure regression test that checks returned certificates have a public key.
File Description
tests/​api/​test_ossl_p7p12.h Declares and registers the new regression test.
tests/​api/​test_ossl_p7p12.c Adds allocation-failure injection and certificate validation.
src/​ssl_p7p12.c Propagates main-certificate parsing failures through error handling.

Review effort: Balanced

pkcs12_fail_alloc_at = -1;
}

(void)wolfSSL_SetAllocators(prevM, prevF, prevR);
@dgarske

dgarske commented Nov 2, 2026

Copy link
Copy Markdown
Member

Okay to test.

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