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

da14531.c: fix name len in memcpy

Public commit record

What the developer wrote

Authored by Marko Bencun

80/100 · Strong
da14531.c: fix name len in memcpy

The BLE name was always <63 bytes due to validation in the
SetDeviceName API call, but since the function itself truncates to the
payload size when copying to the payload stack array, it should also
do so when passing its length to da14531_protocol_format.
✓ 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 small but real bug in how the BitBox02 hardware wallet tells its Bluetooth chip what name to broadcast. The code that copies the device name into a fixed-size buffer correctly limited the copy to 63 bytes, but then accidentally reported the original, possibly longer length to the next processing step. That mismatch could make the Bluetooth formatting function read past the end of the 64-byte buffer, leaking nearby memory or crashing the device. The fix makes the reported length match the actual copied length.

Recommended action

Treat as a low-severity security hardening fix. Verify that SetDeviceName validation is enforced on all code paths and that no caller can pass a name longer than 63 bytes. Consider adding a static or runtime assertion that payload_name_len <= sizeof(payload) - 1.

Security signals we found

01

Length mismatch between memcpy size and reported buffer length

02

Potential out-of-bounds read from a stack buffer

03

Information disclosure via leaked stack memory in Bluetooth advertisement payload

04

Fix is defensive/hardening even if current API validation keeps names under 63 bytes

Risk score

Why this scored 35/100

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