Fix GetLength return value check in ASN1_INTEGER functions#10109
Merged
douzzer merged 1 commit intowolfSSL:masterfrom Mar 31, 2026
Merged
Fix GetLength return value check in ASN1_INTEGER functions#10109douzzer merged 1 commit intowolfSSL:masterfrom
douzzer merged 1 commit intowolfSSL:masterfrom
Conversation
Change GetLength() return check from > 0 to >= 0 in wolfSSL_ASN1_INTEGER_get_length and wolfSSL_ASN1_INTEGER_get0_data. GetLength returns the decoded length (≥ 0) on success and negative error codes on failure, so checking > 0 incorrectly excluded zero-length values, making the DER-stripping logic dead code.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes OpenSSL-compat ASN.1 INTEGER helpers in src/ssl_asn1.c to correctly treat GetLength() returning 0 as a successful decode (rather than an error), which allows DER header stripping to work for zero-length values.
Changes:
- Update
wolfSSL_ASN1_INTEGER_get_length()to acceptGetLength() >= 0so a decoded length of 0 is handled as success. - Update
wolfSSL_ASN1_INTEGER_get0_data()similarly so the returned pointer skips the DER header even when the value length is 0.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Member
Author
|
retest this please ocsp-stapling failure |
padelsbach
approved these changes
Mar 31, 2026
douzzer
approved these changes
Mar 31, 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.
Change GetLength() return check from > 0 to >= 0 in wolfSSL_ASN1_INTEGER_get_length
and wolfSSL_ASN1_INTEGER_get0_data. GetLength returns the decoded length (≥ 0) on
success and negative error codes on failure, so checking > 0 incorrectly excluded
zero-length values, making the DER-stripping logic dead code.