aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/wallet_rpc_server.cpp
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2018-07-03 15:19:54 +0200
committerRiccardo Spagni <ric@spagni.net>2018-07-03 15:19:54 +0200
commit94803bad017de573b4e10d5942efee0ab1a11358 (patch)
tree1957ac5e9d0e20193c4ac0cb1adbc473a5b45c54 /src/wallet/wallet_rpc_server.cpp
parentMerge pull request #4028 (diff)
parentwallet-rpc.getaddress: throw if index is out of bound (diff)
downloadmonero-94803bad017de573b4e10d5942efee0ab1a11358.tar.xz
Merge pull request #4035
66df13a5 wallet-rpc.getaddress: throw if index is out of bound (stoffu)
Diffstat (limited to 'src/wallet/wallet_rpc_server.cpp')
-rw-r--r--src/wallet/wallet_rpc_server.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/wallet/wallet_rpc_server.cpp b/src/wallet/wallet_rpc_server.cpp
index c191b2526..b9cf99635 100644
--- a/src/wallet/wallet_rpc_server.cpp
+++ b/src/wallet/wallet_rpc_server.cpp
@@ -381,6 +381,7 @@ namespace tools
if (!m_wallet) return not_open(er);
try
{
+ THROW_WALLET_EXCEPTION_IF(req.account_index >= m_wallet->get_num_subaddress_accounts(), error::account_index_outofbound);
res.addresses.clear();
std::vector<uint32_t> req_address_index;
if (req.address_index.empty())
@@ -396,6 +397,7 @@ namespace tools
m_wallet->get_transfers(transfers);
for (uint32_t i : req_address_index)
{
+ THROW_WALLET_EXCEPTION_IF(i >= m_wallet->get_num_subaddresses(req.account_index), error::address_index_outofbound);
res.addresses.resize(res.addresses.size() + 1);
auto& info = res.addresses.back();
const cryptonote::subaddress_index index = {req.account_index, i};