aboutsummaryrefslogtreecommitdiff
path: root/src/httprpc.cpp
diff options
context:
space:
mode:
authorPieter Wuille <pieter@wuille.net>2022-04-04 13:52:06 -0400
committerMacroFake <falke.marco@gmail.com>2022-04-27 14:12:55 +0200
commit78f3ac51b7d073d12da6a3b9b7d80d91e04ce3a7 (patch)
tree60a138e61a7281fbba6391da8d0d73bd0c1f9fee /src/httprpc.cpp
parenta65931e3ce66d87b8f83d67ecdbb46f137e6a670 (diff)
downloadbitcoin-78f3ac51b7d073d12da6a3b9b7d80d91e04ce3a7.tar.xz
Make DecodeBase{32,64} return optional instead of taking bool*
Diffstat (limited to 'src/httprpc.cpp')
-rw-r--r--src/httprpc.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/httprpc.cpp b/src/httprpc.cpp
index 96cccd8de9..b9041227be 100644
--- a/src/httprpc.cpp
+++ b/src/httprpc.cpp
@@ -132,10 +132,10 @@ static bool RPCAuthorized(const std::string& strAuth, std::string& strAuthUserna
if (strAuth.substr(0, 6) != "Basic ")
return false;
std::string strUserPass64 = TrimString(strAuth.substr(6));
- bool invalid;
- std::vector<unsigned char> userpass_data = DecodeBase64(strUserPass64, &invalid);
- if (invalid) return false;
- std::string strUserPass(userpass_data.begin(), userpass_data.end());
+ auto userpass_data = DecodeBase64(strUserPass64);
+ std::string strUserPass;
+ if (!userpass_data) return false;
+ strUserPass.assign(userpass_data->begin(), userpass_data->end());
if (strUserPass.find(':') != std::string::npos)
strAuthUsernameOut = strUserPass.substr(0, strUserPass.find(':'));