pay: fix uninitialized var in debug output.
What changed, and why it matters
This is a tiny code cleanup: a debug log message could previously read from an uninitialized variable when a payment channel was disabled. The fix makes the log print "UNKNOWN" instead of a potentially garbage capacity value. It only affects debug output and has no practical security impact.
No action required; treat as routine code-quality fix. If reviewing, confirm no other uninitialized reads remain in the same function.
Security signals we found
Use of potentially uninitialized variable in debug logging
Fix triggered by Valgrind warning
No functional or cryptographic code path affected
Evidence from the diff
In plugins/libplugin-pay.c, channel_hints_update() logs a channel hint’s estimated_capacity even when hint->enabled is false, at which point estimate may not have been set. The patch changes the log format string to only call fmt_amount_msat() when the channel is enabled, otherwise printing “UNKNOWN”. This eliminates a Valgrind-reported use of uninitialized memory in a debug-only log path.
Changed components
plugins/libplugin-pay.cchannel_hints_update() debug log outputInspect captured patch +1 / −1
diff --git a/plugins/libplugin-pay.c b/plugins/libplugin-pay.c
index ec2bcb7a..b296b87d 100644
--- a/plugins/libplugin-pay.c
+++ b/plugins/libplugin-pay.c
@@ -449,7 +449,7 @@ static void channel_hints_update(struct payment *p,
"estimated capacity %s",
fmt_short_channel_id_dir(tmpctx, &hint->scid),
hint->enabled ? "true" : "false",
- fmt_amount_msat(tmpctx, hint->estimated_capacity));
+ hint->enabled ? fmt_amount_msat(tmpctx, hint->estimated_capacity) : "UNKNOWN");
channel_hint_notify(p->plugin, hint);
}
}
Why this scored 17/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.