aboutsummaryrefslogtreecommitdiff
path: root/src/httprpc.cpp
diff options
context:
space:
mode:
authorJoão Barbosa <joao.paulo.barbosa@gmail.com>2020-11-23 12:00:50 +0000
committerJoão Barbosa <joao.paulo.barbosa@gmail.com>2020-11-23 21:02:54 +0000
commit46001323b1f4a57d8d6805f1bc39a5b8d401f0c5 (patch)
treedcf642362f9b159faccf40c62cb07a31390c64cc /src/httprpc.cpp
parentd37c813a43166f559a4e2d1c22e7243f70301291 (diff)
downloadbitcoin-46001323b1f4a57d8d6805f1bc39a5b8d401f0c5.tar.xz
rpc: Validate -rpcauth arguments
Diffstat (limited to 'src/httprpc.cpp')
-rw-r--r--src/httprpc.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/httprpc.cpp b/src/httprpc.cpp
index f3b2619dbd..cb8b220895 100644
--- a/src/httprpc.cpp
+++ b/src/httprpc.cpp
@@ -253,11 +253,14 @@ static bool InitRPCAuthentication()
if (gArgs.GetArg("-rpcauth","") != "")
{
LogPrintf("Using rpcauth authentication.\n");
- for (std::string rpcauth : gArgs.GetArgs("-rpcauth")) {
+ for (const std::string& rpcauth : gArgs.GetArgs("-rpcauth")) {
std::vector<std::string> fields;
boost::split(fields, rpcauth, boost::is_any_of(":$"));
if (fields.size() == 3) {
g_rpcauth.push_back(fields);
+ } else {
+ LogPrintf("Invalid -rpcauth argument.\n");
+ return false;
}
}
}