-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix queryWalletDevice on corrupted wallets
- Loading branch information
Showing
1 changed file
with
35 additions
and
0 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
patches/monero/0020-catch-exception-in-queryWalletDevice.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
From d0774a747e7520f6dae3cf90ecbb682395da8c9c Mon Sep 17 00:00:00 2001 | ||
From: cyan <cyjan@mrcyjanek.net> | ||
Date: Wed, 27 Nov 2024 23:28:32 +0000 | ||
Subject: [PATCH] catch exception in queryWalletDevice | ||
|
||
--- | ||
src/wallet/api/wallet_manager.cpp | 12 ++++++++---- | ||
1 file changed, 8 insertions(+), 4 deletions(-) | ||
|
||
diff --git a/src/wallet/api/wallet_manager.cpp b/src/wallet/api/wallet_manager.cpp | ||
index f88bd9e64..c200f52ae 100644 | ||
--- a/src/wallet/api/wallet_manager.cpp | ||
+++ b/src/wallet/api/wallet_manager.cpp | ||
@@ -213,10 +213,14 @@ bool WalletManagerImpl::verifyWalletPassword(const std::string &keys_file_name, | ||
|
||
bool WalletManagerImpl::queryWalletDevice(Wallet::Device& device_type, const std::string &keys_file_name, const std::string &password, uint64_t kdf_rounds) const | ||
{ | ||
- hw::device::device_type type; | ||
- bool r = tools::wallet2::query_device(type, keys_file_name, password, kdf_rounds); | ||
- device_type = static_cast<Wallet::Device>(type); | ||
- return r; | ||
+ try { | ||
+ hw::device::device_type type; | ||
+ bool r = tools::wallet2::query_device(type, keys_file_name, password, kdf_rounds); | ||
+ device_type = static_cast<Wallet::Device>(type); | ||
+ return r; | ||
+ } catch (...) { | ||
+ return false; | ||
+ } | ||
} | ||
|
||
std::vector<std::string> WalletManagerImpl::findWallets(const std::string &path) | ||
-- | ||
2.43.0 | ||
|