aboutsummaryrefslogtreecommitdiff
path: root/src/rpc/net.cpp
diff options
context:
space:
mode:
authoramadeuszpawlik <apawlik@protonmail.com>2022-05-13 22:29:09 +0200
committeramadeuszpawlik <apawlik@protonmail.com>2022-05-14 10:22:16 +0200
commitada8358ef54aaa04c9182afe115d8046c801bdde (patch)
tree68022c45ccd0fc32fe9d5015bd15d959e7d1ad68 /src/rpc/net.cpp
parent225e5b57b2ee2bc1acd7f09c89ccccc15ef8c85f (diff)
downloadbitcoin-ada8358ef54aaa04c9182afe115d8046c801bdde.tar.xz
Sanitize port in `addpeeraddress()`
- Ensures port sanitization in `addpeeraddress()` - Adds test to check for invalid port values
Diffstat (limited to 'src/rpc/net.cpp')
-rw-r--r--src/rpc/net.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/rpc/net.cpp b/src/rpc/net.cpp
index 09dc8eb3eb..ff714eaf36 100644
--- a/src/rpc/net.cpp
+++ b/src/rpc/net.cpp
@@ -932,7 +932,7 @@ static RPCHelpMan addpeeraddress()
}
const std::string& addr_string{request.params[0].get_str()};
- const uint16_t port{static_cast<uint16_t>(request.params[1].get_int())};
+ const auto port{request.params[1].getInt<uint16_t>()};
const bool tried{request.params[2].isTrue()};
UniValue obj(UniValue::VOBJ);