Skip to content

Harden X509 DER length handling in wolfSSL_X509_get_der and wolfSSL_i2d_X509#10212

Merged
dgarske merged 1 commit into
wolfSSL:masterfrom
ColtonWilley:fix-skid-overflow-and-null-checks
Jun 8, 2026
Merged

Harden X509 DER length handling in wolfSSL_X509_get_der and wolfSSL_i2d_X509#10212
dgarske merged 1 commit into
wolfSSL:masterfrom
ColtonWilley:fix-skid-overflow-and-null-checks

Conversation

@ColtonWilley

@ColtonWilley ColtonWilley commented Apr 13, 2026

Copy link
Copy Markdown
Contributor

Summary

  • src/x509.c: Guard wolfSSL_X509_get_der against derCert->length > INT_MAX, and reject derSz <= 0 in wolfSSL_i2d_X509.
  • tests/api/test_ossl_x509_io.{c,h}: Add API coverage for the X509 DER length guards.

Note

The SRTP KDF work originally mentioned on this branch was absorbed upstream; this PR now contains only X509 DER length hardening.

@ColtonWilley ColtonWilley marked this pull request as draft April 13, 2026 23:45
@ColtonWilley ColtonWilley force-pushed the fix-skid-overflow-and-null-checks branch from b159a2a to 335c054 Compare April 14, 2026 00:51
@ColtonWilley ColtonWilley changed the title Fix SKID buffer overflow in CSR path and add missing NULL checks Fix SRTP KDF null-idx crash and X509 DER length hardening Apr 14, 2026
@ColtonWilley ColtonWilley force-pushed the fix-skid-overflow-and-null-checks branch from 9d00aca to 5bb246e Compare May 5, 2026 19:01
@ColtonWilley ColtonWilley force-pushed the fix-skid-overflow-and-null-checks branch from 5295ab2 to 2d95ee8 Compare May 27, 2026 18:36
@ColtonWilley ColtonWilley changed the title Fix SRTP KDF null-idx crash and X509 DER length hardening Harden X509 DER length handling in wolfSSL_X509_get_der and wolfSSL_i2d_X509 May 28, 2026
@ColtonWilley ColtonWilley force-pushed the fix-skid-overflow-and-null-checks branch from 2d95ee8 to 9d05b0c Compare May 28, 2026 00:38
@ColtonWilley ColtonWilley marked this pull request as ready for review May 28, 2026 01:02
@github-actions

github-actions Bot commented May 28, 2026

Copy link
Copy Markdown

retest this please

@ColtonWilley ColtonWilley force-pushed the fix-skid-overflow-and-null-checks branch from 9d05b0c to d68d575 Compare May 28, 2026 01:11
@ColtonWilley ColtonWilley force-pushed the fix-skid-overflow-and-null-checks branch from d68d575 to a4eec4a Compare June 4, 2026 17:35
…2d_X509

- src/x509.c: Guard wolfSSL_X509_get_der against derCert->length > INT_MAX, and reject derSz <= 0 in wolfSSL_i2d_X509.
- tests/api/test_ossl_x509_io.{c,h}: Add API coverage for the X509 DER length guards.
@ColtonWilley ColtonWilley force-pushed the fix-skid-overflow-and-null-checks branch from a4eec4a to 368e148 Compare June 4, 2026 17:38
@ColtonWilley

ColtonWilley commented Jun 5, 2026

Copy link
Copy Markdown
Contributor Author

retest this please

@ColtonWilley ColtonWilley requested a review from wolfSSL-Bot June 8, 2026 18:24

@dgarske dgarske left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Skoll Code Review

Scan type: reviewOverall recommendation: COMMENT
Findings: 2 total — 2 posted, 0 skipped
2 finding(s) posted as inline comments (see file-level comments below)

Posted findings

  • [Low] MEMORY_E returned for zero-length DER is semantically misleadingsrc/x509.c:8842-8845
  • [Info] Overflow guard is a tautology on (extremely rare) 64-bit-int platformssrc/x509.c:4526-4528

Review generated by Skoll

Comment thread src/x509.c
Comment thread src/x509.c
@dgarske dgarske removed the request for review from wolfSSL-Bot June 8, 2026 22:01
@dgarske dgarske merged commit c9cb0ef into wolfSSL:master Jun 8, 2026
479 of 481 checks passed
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