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

url: improve bounds checking

Public commit record

What the developer wrote

Authored by Mike Tolkachev

35/100 · Opaque
url: improve bounds checking
✓ Descriptive subject! No meaningful explanatory body
The short version

What changed, and why it matters

This commit tightens bounds checks in URL encoding/decoding functions used in Blockstream Jade, a hardware wallet. The changes fix potential off-by-one/out-of-bounds memory reads and writes when handling percent-encoded characters. Because Jade processes untrusted data (e.g., QR codes, USB messages, or companion-app URLs), a malformed URL fragment could previously trigger a buffer overread or, in encoding, a truncated/overwritten output buffer. The patch is defensive and partial: it improves checks but does not fully restructure the API, so residual risks from caller misuse remain possible.

Recommended action

Treat as a security fix and include in the next firmware release. Review callers of urldecode()/urlencode() to ensure src_len and dest_len are always passed correctly and that return-value failures are handled rather than silently using truncated output. Add unit tests covering edge cases: empty input, input ending with '%' or '%X', oversized hex sequences, and minimum-size output buffers.

Security signals we found

01

Bounds-check rewrite in URL decoder to prevent out-of-bounds reads before percent-decoding

02

Cast to unsigned char moved into isxdigit() to avoid undefined behavior with signed char inputs

03

Destination bounds checks in URL encoder changed from pointer-subtraction form to remaining-space form, mitigating possible underflow/wrap

04

Functions process externally supplied URL-encoded data, a common attack surface

05

Commit title explicitly says 'improve bounds checking', indicating security-relevant hardening

Risk score

Why this scored 61/100

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