Fix pathlen not copied in ASN1_OBJECT_dup and not marked set in X509_add_ext#9940
Merged
JacobBarthelmeh merged 1 commit intowolfSSL:masterfrom Mar 12, 2026
Merged
Fix pathlen not copied in ASN1_OBJECT_dup and not marked set in X509_add_ext#9940JacobBarthelmeh merged 1 commit intowolfSSL:masterfrom
JacobBarthelmeh merged 1 commit intowolfSSL:masterfrom
Conversation
Contributor
There was a problem hiding this comment.
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->pathleninwolfSSL_ASN1_OBJECT_dup()with allocation-failure cleanup. - Set
x509->pathLengthSet = 1when 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.
Member
Author
|
Retest this please Jenkins - timeout on PRB-fsanitize-addr-v3 |
Member
Author
|
Currently failing on:
2 looks like it will be fixed with #9944. 1 may be sporadic? |
…xt() when adding basic constraints with a path length
JacobBarthelmeh
approved these changes
Mar 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR:
wolfSSL_ASN1_OBJECT_dup()to duplicate thepathlenASN1_INTEGER field, with cleanup on allocation failure.wolfSSL_X509_add_ext()to setpathLengthSet = 1when 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