What changed, and why it matters
This commit fixes a single-character bug in the hardware wallet's 'connect wallet' screen. The original code used a single equals sign (=) instead of a double equals sign (==), which in C means it assigned a value rather than checking it. As a result, the code always treated the wallet as a Bitcoin wallet and ran the Bitcoin-specific tutorial branch, regardless of which wallet the user actually selected. The fix changes it to a proper comparison (==).
Review whether the overwritten `wallet` pointer value is used after this block (e.g., in the event callback data passed to OpenBtcWalletTutorialHandler). If downstream code dereferences `wallet`, the assignment could cause a stale or incorrect pointer to be passed. Also audit the codebase for similar `=` vs `==` typos, ideally with compiler warnings (-Wall -Wparentheses) or static analysis.
Security signals we found
Assignment-instead-of-comparison bug (C typo)
Logic flow manipulation: non-BTC wallets incorrectly routed to BTC-specific tutorial handler
Pointer value overwritten by constant enum, potentially affecting downstream event-callback data
Evidence from the diff
In OpenMoreHandler() in gui_connect_wallet_widgets.c, the conditional if (*wallet = WALLET_LIST_BTC_WALLET) was an assignment, not a comparison. This caused the pointer wallet to be overwritten with the BTC wallet enum value every time the ‘more’ hint box opened, and the condition always evaluated to true (non-zero). The patch changes it to if (*wallet == WALLET_LIST_BTC_WALLET).
Changed components
src/ui/gui_widgets/multi/web3/gui_connect_wallet_widgets.cOpenMoreHandler()wallet selection / connect-wallet UI flowInspect captured patch +1 / −1
diff --git a/src/ui/gui_widgets/multi/web3/gui_connect_wallet_widgets.c b/src/ui/gui_widgets/multi/web3/gui_connect_wallet_widgets.c
index 2516cf0..4061463 100644
--- a/src/ui/gui_widgets/multi/web3/gui_connect_wallet_widgets.c
+++ b/src/ui/gui_widgets/multi/web3/gui_connect_wallet_widgets.c
@@ -1805,7 +1805,7 @@ static void OpenMoreHandler(lv_event_t *e)
lv_obj_add_event_cb(lv_obj_get_child(g_openMoreHintBox, 0),
CloseHintBoxHandler, LV_EVENT_CLICKED,
&g_openMoreHintBox);
- if (*wallet = WALLET_LIST_BTC_WALLET) {
+ if (*wallet == WALLET_LIST_BTC_WALLET) {
btn = GuiCreateSelectButton(g_openMoreHintBox, _("Tutorial"), &imgTutorial,
OpenBtcWalletTutorialHandler, wallet, true);
} else {
Why this scored 47/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.