mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 06:58:57 +01:00
net: Avoid using C-style NUL-terminated strings as arguments in the netbase interface
This commit is contained in:
@@ -172,7 +172,7 @@ static bool InitHTTPAllowList()
|
||||
rpc_allow_subnets.push_back(CSubNet(localv6)); // always allow IPv6 localhost
|
||||
for (const std::string& strAllow : gArgs.GetArgs("-rpcallowip")) {
|
||||
CSubNet subnet;
|
||||
LookupSubNet(strAllow.c_str(), subnet);
|
||||
LookupSubNet(strAllow, subnet);
|
||||
if (!subnet.IsValid()) {
|
||||
uiInterface.ThreadSafeMessageBox(
|
||||
strprintf("Invalid -rpcallowip subnet specification: %s. Valid are a single IP (e.g. 1.2.3.4), a network/netmask (e.g. 1.2.3.4/255.255.255.0) or a network/CIDR (e.g. 1.2.3.4/24).", strAllow),
|
||||
@@ -324,7 +324,7 @@ static bool HTTPBindAddresses(struct evhttp* http)
|
||||
evhttp_bound_socket *bind_handle = evhttp_bind_socket_with_handle(http, i->first.empty() ? nullptr : i->first.c_str(), i->second);
|
||||
if (bind_handle) {
|
||||
CNetAddr addr;
|
||||
if (i->first.empty() || (LookupHost(i->first.c_str(), addr, false) && addr.IsBindAny())) {
|
||||
if (i->first.empty() || (LookupHost(i->first, addr, false) && addr.IsBindAny())) {
|
||||
LogPrintf("WARNING: the RPC server is not safe to expose to untrusted networks such as the public internet\n");
|
||||
}
|
||||
boundSockets.push_back(bind_handle);
|
||||
|
||||
Reference in New Issue
Block a user