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

fix(crypto): fix cash_encode

Public commit record

What the developer wrote

Authored by M1nd3r

82/100 · Strong
fix(crypto): fix cash_encode

- Fixed description of buffer sizes in the header file.
- Added check of hrp length in cash_encode. Otherwise it allows to encode addresses that cannot be decoded using cash_decode.
- Adjusted naming of constants and parameters for clarity and consistency.

[no changelog]
✓ Descriptive subject✓ Uses a recognizable type or scope✓ Provides detailed explanatory context✓ Explains rationale or failure mode
The short version

What changed, and why it matters

This commit fixes a mismatch in Trezor's Bitcoin Cash address encoding. Previously, the encoder could create addresses with an overly long human-readable prefix (the part before the colon, like 'bitcoincash') that the decoder would later reject as invalid. The patch adds a length check so the encoder refuses to produce addresses that cannot be decoded. It also renames variables and updates comments for clarity, with no functional changes beyond the new length check.

Recommended action

Review callers of cash_addr_encode/cash_encode to confirm they handle the new failure mode (return 0) correctly, and verify that downstream UI or transaction code does not assume encoding always succeeds. Consider adding unit tests for HRP length edge cases.

Security signals we found

01

Added input-validation boundary check on hrp length in cash_encode

02

Fixed encode/decode asymmetry that allowed generation of invalid cashaddr strings

03

Header comments corrected to reflect actual required output buffer sizes

04

No changelog entry despite functional behavior change

Risk score

Why this scored 37/100

Our methodology →
Potential impact 8/30
Exploitability 7/25
Stealth signal 6/15
Affected reach 5/15
Confidence 7/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.