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

ccan: add json_escape_len in json_out_addstrn

Public commit record

What the developer wrote

Authored by Sangbida Chaudhuri

45/100 · Thin
ccan: add json_escape_len in json_out_addstrn
✓ Descriptive subject✓ Names a concrete action or component! No meaningful explanatory body
The short version

What changed, and why it matters

This is a one-line fix in a helper library that builds JSON output. The function json_out_addstrn is supposed to add a string of a specific length, but it was escaping the entire string using a function that ignores the requested length. This could cause a string that contains bytes beyond the intended length to be incorrectly included in JSON output, potentially leaking nearby memory or producing malformed JSON. The patch makes the escaping respect the intended length.

Recommended action

Review all call sites of json_out_addstrn in Core Lightning to determine whether any pass buffers that are not NUL-terminated or where 'len' is shorter than strlen(str). If such call sites exist, assess them for possible memory disclosure or JSON injection. Apply the patch and include it in the next release.

Security signals we found

01

Out-of-bounds read risk: json_escape(NULL, str) reads past the intended length if the buffer is not NUL-terminated or contains embedded NULs

02

Potential information disclosure: escaped output could include unintended adjacent memory bytes

03

JSON correctness issue: emitted string length may not match caller's declared length

04

Fix is minimal and targeted, consistent with a bug/security patch

Risk score

Why this scored 49/100

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