AI-generated analysisPublished automatically and not human-verified. Validated context appears in community notes below.
← Watch feed
Moderate 60 Bitcoin

common/wireaddr: Fix an out-of-bounds bug in the address parser

Public commit record

What the developer wrote

Authored by Chandra Pratap

85/100 · Strong
common/wireaddr: Fix an out-of-bounds bug in the address parser

Changelog-Fixed: In `struct wireaddr`, the `addr` buffer is defined
with a length of DNS_ADDRLEN (255). When parsing a valid DNS name
that is exactly 255 bytes long, the subsequent attempt to append a
`NULL` terminator overruns the buffer and triggers an out-of-bounds
error under UBSan.

Fix this by removing the line that appends `NULL`. This change is
safe because the preceding call to:

`memset(&addr->addr, 0, sizeof(addr->addr))`

already zeroes the entire buffer.
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Explains rationale or failure mode
The short version

What changed, and why it matters

This commit fixes a one-byte buffer overflow in Core Lightning's network address parser. When handling a DNS address that is exactly 255 bytes long, the code tried to add a trailing zero byte past the end of a 255-byte buffer. The fix simply removes that extra write, because the buffer is already fully zeroed beforehand. It is a genuine bug fix, but the practical security impact is limited because the overflow is only one byte and occurs in a controlled parsing path.

Recommended action

Apply the patch. It is a clean one-line removal with no functional change for valid inputs. Consider adding a regression test with a 255-byte DNS address to prevent reintroduction.

Security signals we found

01

Out-of-bounds write in address parser

02

Buffer length off-by-one for maximum-length DNS name

03

UBSan-detectable undefined behavior

04

Fix removes unnecessary null-termination after zeroing buffer

Risk score

Why this scored 60/100

Our methodology →
Potential impact 18/30
Exploitability 12/25
Stealth signal 8/15
Affected reach 10/15
Confidence 8/10
Evidence quality 4/5
Human-validated context

Community notes

Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.

No validated notes yet.

The AI analysis stands alone for now. Submit a note if you can add evidence or important context.