Fixing out of bounds error in GetKey()

This commit is contained in:
ENikS 2014-09-22 16:24:42 -04:00 committed by Wladimir J. van der Laan
parent cb9871194a
commit 6f3ae9b5df
1 changed files with 2 additions and 1 deletions

View File

@ -288,7 +288,8 @@ void CBitcoinSecret::SetKey(const CKey& vchSecret)
CKey CBitcoinSecret::GetKey()
{
CKey ret;
ret.Set(&vchData[0], &vchData[32], vchData.size() > 32 && vchData[32] == 1);
assert(vchData.size() >= 32);
ret.Set(vchData.begin(), vchData.begin() + 32, vchData.size() > 32 && vchData[32] == 1);
return ret;
}