mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-10 10:52:31 -05:00
RPCConsole: Throw when overflowing size_t type for array indices
This commit is contained in:
parent
c79d9fb2f6
commit
faa5e171e6
1 changed files with 5 additions and 4 deletions
|
@ -247,10 +247,11 @@ bool RPCConsole::RPCParseCommandLine(interfaces::Node* node, std::string &strRes
|
||||||
UniValue subelement;
|
UniValue subelement;
|
||||||
if (lastResult.isArray())
|
if (lastResult.isArray())
|
||||||
{
|
{
|
||||||
for(char argch: curarg)
|
const auto parsed{ToIntegral<size_t>(curarg)};
|
||||||
if (!IsDigit(argch))
|
if (!parsed) {
|
||||||
throw std::runtime_error("Invalid result query");
|
throw std::runtime_error("Invalid result query");
|
||||||
subelement = lastResult[LocaleIndependentAtoi<int>(curarg)];
|
}
|
||||||
|
subelement = lastResult[parsed.value()];
|
||||||
}
|
}
|
||||||
else if (lastResult.isObject())
|
else if (lastResult.isObject())
|
||||||
subelement = find_value(lastResult, curarg);
|
subelement = find_value(lastResult, curarg);
|
||||||
|
|
Loading…
Add table
Reference in a new issue