Skip to content

Fix out-of-bounds read parsing IPv4 SAN entries in TLS certs#812

Open
MarkRose wants to merge 1 commit into
sm0svx:masterfrom
MarkRose:fix-san-ipv4-overread
Open

Fix out-of-bounds read parsing IPv4 SAN entries in TLS certs#812
MarkRose wants to merge 1 commit into
sm0svx:masterfrom
MarkRose:fix-san-ipv4-overread

Conversation

@MarkRose

Copy link
Copy Markdown
Contributor
  • In SslX509ExtSubjectAltName's GEN_IPADD handling, an IPv4 iPAddress
    SAN is a 4-byte ASN.1 octet string, but the code dereferenced it as
    *reinterpret_cast<const unsigned long*>(data), reading a full
    unsigned long (8 bytes on LP64/64-bit Linux) and thus 4 bytes past
    the end of the 4-byte buffer. Fixed by copying exactly 4 bytes into
    a uint32_t via memcpy before assigning to in_addr.s_addr.

Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com

- In SslX509ExtSubjectAltName's GEN_IPADD handling, an IPv4 iPAddress
  SAN is a 4-byte ASN.1 octet string, but the code dereferenced it as
  `*reinterpret_cast<const unsigned long*>(data)`, reading a full
  `unsigned long` (8 bytes on LP64/64-bit Linux) and thus 4 bytes past
  the end of the 4-byte buffer. Fixed by copying exactly 4 bytes into
  a uint32_t via memcpy before assigning to in_addr.s_addr.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@MarkRose MarkRose closed this Jul 12, 2026
@MarkRose MarkRose reopened this Jul 12, 2026
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.

1 participant