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

common: implement str_to_u64, make json_to_u64 use it.

Public commit record

What the developer wrote

Authored by Rusty Russell

73/100 · Adequate
common: implement str_to_u64, make json_to_u64 use it.

The prior implementation could read past the end of the buffer (we actually
pad our JSON so this isn't harmful, but still). Fix up json_to_s64 and
json_to_double too, but since they're not used as often, just copy the
string there.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context
The short version

What changed, and why it matters

This commit fixes a bug in how Core Lightning parsed unsigned 64-bit integers from JSON. The old code used a standard C library function (strtoull) that could read beyond the intended token boundary. The commit author notes this is not currently harmful because JSON buffers are padded, but it is still a defensive fix. The commit also applies similar safer handling to signed 64-bit and double parsing.

Recommended action

Treat as a low-severity hardening fix. Review whether any other JSON numeric parsers in the codebase rely on similar strto* pointer comparisons without copying or bounding input. No immediate emergency action is indicated because the author states JSON is padded, but the fix should be included in normal releases.

Security signals we found

01

Out-of-bounds read risk in JSON numeric parsing

02

Use of unbounded C library string-to-number conversion on non-null-terminated input

03

Defensive hardening of integer parsing helpers

04

Overflow checks added/reinforced for u64 parsing

Risk score

Why this scored 34/100

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