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

Account for terminating '\0' in maximum length of ext_pubkey_str

Public commit record

What the developer wrote

Authored by Salvatore Ingala

50/100 · Thin
Account for terminating '\0' in maximum length of ext_pubkey_str
✓ Specific, descriptive subject✓ Names a concrete action or component! No meaningful explanatory body
The short version

What changed, and why it matters

This commit fixes a small but real off-by-one buffer sizing bug in the Ledger Bitcoin app's wallet code. A string buffer meant to hold a serialized extended public key was sized to the maximum character length, but C strings need an extra byte for the terminating null character ('\0'). Without that extra byte, code later reading or copying the string could read past the buffer or write the terminator into adjacent memory, which on a constrained hardware wallet could potentially leak secrets or cause a crash. The fix adds the missing +1 byte.

Recommended action

Review the rest of parse_policy_map_key_info() and any callers to confirm the string is now always null-terminated before use, and check whether similar MAX_SERIALIZED_PUBKEY_LENGTH-sized buffers elsewhere in the codebase have the same issue. Consider adding a static assertion or explicit terminator write to make the invariant obvious.

Security signals we found

01

Off-by-one buffer size missing null terminator

02

Potential stack buffer over-read or adjacent memory corruption

03

Extended public key parsing in hardware wallet code

04

No explicit bounds check on string termination visible in diff

Risk score

Why this scored 58/100

Our methodology →
Potential impact 18/30
Exploitability 12/25
Stealth signal 8/15
Affected reach 10/15
Confidence 7/10
Evidence quality 3/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.