Merge pull request #4035
66df13a5
wallet-rpc.getaddress: throw if index is out of bound (stoffu)
This commit is contained in:
commit
94803bad01
|
@ -381,6 +381,7 @@ namespace tools
|
||||||
if (!m_wallet) return not_open(er);
|
if (!m_wallet) return not_open(er);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
THROW_WALLET_EXCEPTION_IF(req.account_index >= m_wallet->get_num_subaddress_accounts(), error::account_index_outofbound);
|
||||||
res.addresses.clear();
|
res.addresses.clear();
|
||||||
std::vector<uint32_t> req_address_index;
|
std::vector<uint32_t> req_address_index;
|
||||||
if (req.address_index.empty())
|
if (req.address_index.empty())
|
||||||
|
@ -396,6 +397,7 @@ namespace tools
|
||||||
m_wallet->get_transfers(transfers);
|
m_wallet->get_transfers(transfers);
|
||||||
for (uint32_t i : req_address_index)
|
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);
|
res.addresses.resize(res.addresses.size() + 1);
|
||||||
auto& info = res.addresses.back();
|
auto& info = res.addresses.back();
|
||||||
const cryptonote::subaddress_index index = {req.account_index, i};
|
const cryptonote::subaddress_index index = {req.account_index, i};
|
||||||
|
|
Loading…
Reference in New Issue