diff options
| author | Wladimir J. van der Laan <[email protected]> | 2019-10-28 13:41:45 +0100 |
|---|---|---|
| committer | Wladimir J. van der Laan <[email protected]> | 2019-10-28 13:41:45 +0100 |
| commit | f3b51eb9352d7a7c5dfa15615efc8bc0a52ffecf (patch) | |
| tree | b580be6a30428150b6ec40ca5da5bb96ee746fb1 /src/wallet/crypter.cpp | |
| parent | Merge #17250: Avoid unused call to GuessVerificationProgress in NotifyHeaderTip (diff) | |
| download | discoin-f3b51eb9352d7a7c5dfa15615efc8bc0a52ffecf.tar.xz discoin-f3b51eb9352d7a7c5dfa15615efc8bc0a52ffecf.zip | |
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/wallet/crypter.cpp')
| -rw-r--r-- | src/wallet/crypter.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/wallet/crypter.cpp b/src/wallet/crypter.cpp index f6179aa29..b50f00e7d 100644 --- a/src/wallet/crypter.cpp +++ b/src/wallet/crypter.cpp @@ -23,7 +23,7 @@ int CCrypter::BytesToKeySHA512AES(const std::vector<unsigned char>& chSalt, cons unsigned char buf[CSHA512::OUTPUT_SIZE]; CSHA512 di; - di.Write((const unsigned char*)strKeyData.c_str(), strKeyData.size()); + di.Write((const unsigned char*)strKeyData.data(), strKeyData.size()); di.Write(chSalt.data(), chSalt.size()); di.Finalize(buf); |