net: Avoid using C-style NUL-terminated strings as arguments in the netbase interface

This commit is contained in:
practicalswift
2019-12-11 16:39:29 +00:00
parent fcef6dbc15
commit 9574de86ad
11 changed files with 74 additions and 54 deletions

View File

@@ -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");