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

p2p: error on `CommandString` interior null bytes

Public commit record

What the developer wrote

Authored by yancy

68/100 · Adequate
p2p: error on `CommandString` interior null bytes

Add an invariant that a `CommandString` cannot have a null byte
preceding a non null byte as part of the command string.
✓ Descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context
The short version

What changed, and why it matters

This commit tightens validation for Bitcoin P2P message command strings. Previously, a command string could contain a null byte in the middle followed by more characters (for example "And\0rew"). Such malformed strings are now rejected both when created from Rust code and when received from the network. This prevents odd or potentially dangerous command strings from being accepted as valid.

Recommended action

Review downstream consumers of `CommandString` to ensure they do not rely on interior-null command strings. Consider whether the decoder error mapping (`NotAscii`) accurately describes the new failure mode, and add a dedicated error variant if needed. Otherwise, this is a defensive hardening change that should be merged and released normally.

Security signals we found

01

New input-validation invariant added to network-facing type

02

Rejects malformed command strings during deserialization

03

Prevents acceptance of command strings with embedded null bytes followed by data

04

Test expectations inverted from success to failure for interior-null inputs

Risk score

Why this scored 48/100

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