wire: explicitly set nonblocking default to false
What changed, and why it matters
This commit fixes a small but real bug in Blockstream Jade's USB/serial message handling. A variable that decides whether a version-info message should get an immediate reply was not given a safe starting value. In C, that means it could accidentally contain leftover garbage data, causing the device to reply immediately when it shouldn't. The fix simply sets that variable to 'false' by default. This is a defensive hardening change; there is no public evidence it has been exploited.
Treat as a low-severity hardening fix. Merge the patch. Review nearby rpc_get_* helpers for similar uninitialized-output patterns and consider adding output initialization in the helper itself.
Security signals we found
Use of uninitialized local variable (CWE-457)
Potential logic bypass in immediate-message handling
Defensive initialization hardening
Evidence from the diff
In main/wire.c, the local bool ‘nonblocking’ was declared without initialization. Its value was only set if rpc_get_boolean(‘nonblocking’, …) succeeded. Because C does not default-initialize automatic variables, an absent or malformed ‘nonblocking’ parameter could leave the variable with indeterminate stack contents. The condition ‘&& nonblocking’ could then evaluate true spuriously, causing handle_immediate_message() to treat a normal version-info message as nonblocking and reply immediately. The patch initializes nonblocking = false, making the default safe and deterministic.
Changed components
main/wire.chandle_immediate_message()version-info / VERINFO message pathInspect captured patch +1 / −1
diff --git a/main/wire.c b/main/wire.c
index 93f0b8e..8ae49b7 100644
--- a/main/wire.c
+++ b/main/wire.c
@@ -78,7 +78,7 @@ static bool handle_immediate_message(const cbor_msg_t* const ctx)
} else if (method_len == sizeof(VERINFO) && !strncmp(method, VERINFO, method_len)) {
// Version-info message - reply immediately if it contains the 'nonblocking' flag
CborValue params;
- bool nonblocking;
+ bool nonblocking = false;
if (rpc_get_map("params", &ctx->value, ¶ms) && rpc_get_boolean("nonblocking", ¶ms, &nonblocking)
&& nonblocking) {
JADE_LOGI("VerInfoEx message, replying immediately");
Why this scored 35/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.