CBase58Data::SetString: cleanse the full vector

SetString seems to be passing the length of the wrong variable to
memory_cleanse, resulting in the last byte of the temporary buffer not being
securely erased.

Github-Pull: #7922
Rebased-From: 57704499be948c640c789c7fc11ed1abf8a681bd
This commit is contained in:
Kaz Wesley 2016-04-18 23:56:06 +02:00 committed by MarcoFalke
parent 43c14acf14
commit c3d1bc33b5

View File

@ -172,7 +172,7 @@ bool CBase58Data::SetString(const char* psz, unsigned int nVersionBytes)
vchData.resize(vchTemp.size() - nVersionBytes); vchData.resize(vchTemp.size() - nVersionBytes);
if (!vchData.empty()) if (!vchData.empty())
memcpy(&vchData[0], &vchTemp[nVersionBytes], vchData.size()); memcpy(&vchData[0], &vchTemp[nVersionBytes], vchData.size());
memory_cleanse(&vchTemp[0], vchData.size()); memory_cleanse(&vchTemp[0], vchTemp.size());
return true; return true;
} }