Skip to content

Fix pathlen not copied in ASN1_OBJECT_dup and not marked set in X509_add_ext#9940

Merged
JacobBarthelmeh merged 1 commit intowolfSSL:masterfrom
cconlon:pathLenSet
Mar 12, 2026
Merged

Fix pathlen not copied in ASN1_OBJECT_dup and not marked set in X509_add_ext#9940
JacobBarthelmeh merged 1 commit intowolfSSL:masterfrom
cconlon:pathLenSet

Conversation

@cconlon
Copy link
Member

@cconlon cconlon commented Mar 10, 2026

Description

This PR:

  • Fixes wolfSSL_ASN1_OBJECT_dup() to duplicate the pathlen ASN1_INTEGER field, with cleanup on allocation failure.
  • Fixes wolfSSL_X509_add_ext() to set pathLengthSet = 1 when adding a basic constraints extension that includes a path length.

Testing

Simple unit tests added. Originally caught when doing Java/JNI feature expansion work.

Checklist

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

Copilot AI review requested due to automatic review settings March 10, 2026 16:32
Copy link
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 missing propagation of basic-constraints path length metadata by (1) ensuring wolfSSL_ASN1_OBJECT_dup() duplicates the pathlen field and (2) ensuring wolfSSL_X509_add_ext() marks pathLengthSet when a path length is present.

Changes:

  • Duplicate obj->pathlen in wolfSSL_ASN1_OBJECT_dup() with allocation-failure cleanup.
  • Set x509->pathLengthSet = 1 when adding basic constraints with a path length.
  • Add unit tests covering both behaviors.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
tests/api/test_ossl_x509_ext.c Adds assertions that pathLengthSet is set when basic constraints includes a path length.
tests/api/test_ossl_asn1.c Adds tests verifying ASN1_OBJECT_dup copies (or preserves NULL) pathlen.
src/x509.c Sets pathLengthSet when applying basic constraints with a path length.
src/ssl_asn1.c Copies pathlen during ASN1 object duplication and guards follow-on duplication when allocation fails.

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

@cconlon cconlon added the For This Release Release version 5.9.0 label Mar 10, 2026
@cconlon cconlon self-assigned this Mar 10, 2026
@cconlon
Copy link
Member Author

cconlon commented Mar 10, 2026

Retest this please Jenkins - timeout on PRB-fsanitize-addr-v3

@cconlon
Copy link
Member Author

cconlon commented Mar 10, 2026

Currently failing on:

  1. PRB-FIPS-windows-test-ACVP (Cannot open include file: 'BaseTsd.h': No such file or directory)
  2. PRB-generic-config-parser (FAIL scripts/google.test)

2 looks like it will be fixed with #9944. 1 may be sporadic?

…xt() when adding basic constraints with a path length
@JacobBarthelmeh JacobBarthelmeh merged commit a05a3ed into wolfSSL:master Mar 12, 2026
453 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

For This Release Release version 5.9.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants