mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 22:50:59 +01:00
net: Avoid using C-style NUL-terminated strings as arguments in the netbase interface
This commit is contained in:
@@ -562,11 +562,11 @@ static UniValue setban(const JSONRPCRequest& request)
|
||||
|
||||
if (!isSubnet) {
|
||||
CNetAddr resolved;
|
||||
LookupHost(request.params[0].get_str().c_str(), resolved, false);
|
||||
LookupHost(request.params[0].get_str(), resolved, false);
|
||||
netAddr = resolved;
|
||||
}
|
||||
else
|
||||
LookupSubNet(request.params[0].get_str().c_str(), subNet);
|
||||
LookupSubNet(request.params[0].get_str(), subNet);
|
||||
|
||||
if (! (isSubnet ? subNet.IsValid() : netAddr.IsValid()) )
|
||||
throw JSONRPCError(RPC_CLIENT_INVALID_IP_OR_SUBNET, "Error: Invalid IP/Subnet");
|
||||
|
||||
Reference in New Issue
Block a user