aboutsummaryrefslogtreecommitdiff
path: root/src/httprpc.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@protonmail.com>2019-10-28 13:41:45 +0100
committerWladimir J. van der Laan <laanwj@protonmail.com>2019-10-28 13:41:45 +0100
commitf3b51eb9352d7a7c5dfa15615efc8bc0a52ffecf (patch)
treeb580be6a30428150b6ec40ca5da5bb96ee746fb1 /src/httprpc.cpp
parenta25945318fdc2890a141a28843c2c5af251c9605 (diff)
Fix occurences of c_str() used with size() to data()
Using `data()` better communicates the intent here. Also, depending on how `c_str()` is implemented, this fixes undefined behavior: The part of the string after the first NULL character might have undefined contents.
Diffstat (limited to 'src/httprpc.cpp')
-rw-r--r--src/httprpc.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/httprpc.cpp b/src/httprpc.cpp
index 2c2f67b169..0437f0c7de 100644
--- a/src/httprpc.cpp
+++ b/src/httprpc.cpp
@@ -112,7 +112,7 @@ static bool multiUserAuthorized(std::string strUserPass)
static const unsigned int KEY_SIZE = 32;
unsigned char out[KEY_SIZE];
- CHMAC_SHA256(reinterpret_cast<const unsigned char*>(strSalt.c_str()), strSalt.size()).Write(reinterpret_cast<const unsigned char*>(strPass.c_str()), strPass.size()).Finalize(out);
+ CHMAC_SHA256(reinterpret_cast<const unsigned char*>(strSalt.data()), strSalt.size()).Write(reinterpret_cast<const unsigned char*>(strPass.data()), strPass.size()).Finalize(out);
std::vector<unsigned char> hexvec(out, out+KEY_SIZE);
std::string strHashFromPass = HexStr(hexvec);