bugfix: Strict type checking for RPC boolean parameters

This commit is contained in:
MarcoFalke
2022-12-05 15:15:36 +01:00
parent 9052d869c9
commit fa2cc5d1d6
4 changed files with 14 additions and 8 deletions

View File

@@ -731,9 +731,7 @@ static RPCHelpMan setban()
if (!request.params[2].isNull())
banTime = request.params[2].getInt<int64_t>();
bool absolute = false;
if (request.params[3].isTrue())
absolute = true;
const bool absolute{request.params[3].isNull() ? false : request.params[3].get_bool()};
if (isSubnet) {
node.banman->Ban(subNet, banTime, absolute);
@@ -942,7 +940,7 @@ static RPCHelpMan addpeeraddress()
const std::string& addr_string{request.params[0].get_str()};
const auto port{request.params[1].getInt<uint16_t>()};
const bool tried{request.params[2].isTrue()};
const bool tried{request.params[2].isNull() ? false : request.params[2].get_bool()};
UniValue obj(UniValue::VOBJ);
CNetAddr net_addr;