mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 23:18:14 +01:00
net: Avoid using C-style NUL-terminated strings as arguments in the netbase interface
This commit is contained in:
@@ -1354,7 +1354,7 @@ bool AppInitMain(NodeContext& node)
|
||||
SetReachable(NET_ONION, false);
|
||||
if (proxyArg != "" && proxyArg != "0") {
|
||||
CService proxyAddr;
|
||||
if (!Lookup(proxyArg.c_str(), proxyAddr, 9050, fNameLookup)) {
|
||||
if (!Lookup(proxyArg, proxyAddr, 9050, fNameLookup)) {
|
||||
return InitError(strprintf(_("Invalid -proxy address or hostname: '%s'").translated, proxyArg));
|
||||
}
|
||||
|
||||
@@ -1378,7 +1378,7 @@ bool AppInitMain(NodeContext& node)
|
||||
SetReachable(NET_ONION, false);
|
||||
} else {
|
||||
CService onionProxy;
|
||||
if (!Lookup(onionArg.c_str(), onionProxy, 9050, fNameLookup)) {
|
||||
if (!Lookup(onionArg, onionProxy, 9050, fNameLookup)) {
|
||||
return InitError(strprintf(_("Invalid -onion address or hostname: '%s'").translated, onionArg));
|
||||
}
|
||||
proxyType addrOnion = proxyType(onionProxy, proxyRandomize);
|
||||
@@ -1396,7 +1396,7 @@ bool AppInitMain(NodeContext& node)
|
||||
|
||||
for (const std::string& strAddr : gArgs.GetArgs("-externalip")) {
|
||||
CService addrLocal;
|
||||
if (Lookup(strAddr.c_str(), addrLocal, GetListenPort(), fNameLookup) && addrLocal.IsValid())
|
||||
if (Lookup(strAddr, addrLocal, GetListenPort(), fNameLookup) && addrLocal.IsValid())
|
||||
AddLocal(addrLocal, LOCAL_MANUAL);
|
||||
else
|
||||
return InitError(ResolveErrMsg("externalip", strAddr));
|
||||
@@ -1776,7 +1776,7 @@ bool AppInitMain(NodeContext& node)
|
||||
|
||||
for (const std::string& strBind : gArgs.GetArgs("-bind")) {
|
||||
CService addrBind;
|
||||
if (!Lookup(strBind.c_str(), addrBind, GetListenPort(), false)) {
|
||||
if (!Lookup(strBind, addrBind, GetListenPort(), false)) {
|
||||
return InitError(ResolveErrMsg("bind", strBind));
|
||||
}
|
||||
connOptions.vBinds.push_back(addrBind);
|
||||
|
||||
Reference in New Issue
Block a user