mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 23:18:14 +01:00
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.
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user