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

util: Check write failures before renaming settings.json

Public commit record

What the developer wrote

Authored by Shrey

91/100 · Strong
util: Check write failures before renaming settings.json

In WriteSettings(), verify that writing to the stream and closing it
succeeded before returning true. This prevents RenameOver() from replacing
a valid settings.json with a corrupted or zero-byte file when write limits
or a full disk are encountered.

Additionally, update the ReadSettings() parse failure message to mention
power loss, full disk, or storage error as possible causes.

Fixes #35373
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Mentions testing or verification✓ Links an issue, advisory, or supporting reference
The short version

What changed, and why it matters

This commit fixes a bug in how Bitcoin Core saves its settings file. Previously, if the disk was full or a write failed, the program could replace the user's valid settings file with an empty or corrupted one. Now it checks that the new file was written successfully before overwriting the old one. It also updates an error message to mention power loss, full disk, or storage errors as possible causes of a damaged settings file. This is a reliability and data-loss fix, not an attack that a remote hacker can exploit.

Recommended action

No urgent action required. This is a defensive patch that improves resilience against disk-full and write-failure conditions. Users and node operators should keep systems updated normally; operators running nodes on constrained storage should monitor disk space and logs for the new error messages.

Security signals we found

01

Data integrity / data-loss prevention

02

Filesystem/disk-full failure handling

03

Atomic file replacement safety check

04

Settings file corruption mitigation

Risk score

Why this scored 43/100

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