Skip to content

Commit 6c3907e

Browse files
vrockz747TejasvOnly
authored andcommitted
fix(app): End flow on early exit
1 parent 6221e87 commit 6c3907e

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/wallet/verify_pin_flow.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ static verification_state_e get_verified_pin_handler(verification_state_e state,
138138
* passphrase input occurs, or a card abort error occurs
139139
*
140140
*/
141-
static void get_verified_pin(const uint8_t *wallet_id,
141+
static bool get_verified_pin(const uint8_t *wallet_id,
142142
verification_state_e init_state,
143143
uint8_t pin[MAX_PIN_SIZE],
144144
rejection_cb *reject_cb);
@@ -232,13 +232,13 @@ static verification_state_e get_verified_pin_handler(verification_state_e state,
232232
return next_state;
233233
}
234234

235-
static void get_verified_pin(const uint8_t *wallet_id,
235+
static bool get_verified_pin(const uint8_t *wallet_id,
236236
verification_state_e init_state,
237237
uint8_t pin[MAX_PIN_SIZE],
238238
rejection_cb *reject_cb) {
239239
// Select wallet based on wallet_id
240240
if (!get_wallet_data_by_id(wallet_id, &wallet, reject_cb)) {
241-
return NULL;
241+
return false;
242242
}
243243

244244
// Run flow till it reaches a completion state
@@ -258,6 +258,7 @@ static void get_verified_pin(const uint8_t *wallet_id,
258258
// Inform the host of any rejection
259259
reject_cb(ERROR_COMMON_ERROR_USER_REJECTION_TAG,
260260
ERROR_USER_REJECTION_CONFIRMATION);
261+
return false;
261262
}
262263
}
263264

@@ -274,7 +275,9 @@ bool verify_pin(const uint8_t *wallet_id,
274275
clear_wallet_data();
275276
mnemonic_clear();
276277

277-
get_verified_pin(wallet_id, PIN_INPUT, pin_out, reject_cb);
278+
if (!get_verified_pin(wallet_id, PIN_INPUT, pin_out, reject_cb)) {
279+
return false;
280+
}
278281

279282
mnemonic_clear();
280283
clear_wallet_data();

0 commit comments

Comments
 (0)