Add length check for CExtKey deserialization

This commit is contained in:
Jonas Schnelli 2017-08-17 21:54:23 +02:00
parent 22e301a3d5
commit 07685d1bc1
No known key found for this signature in database
GPG key ID: 1EB776BB03C7922D

View file

@ -172,6 +172,8 @@ struct CExtKey {
{
unsigned int len = ::ReadCompactSize(s);
unsigned char code[BIP32_EXTKEY_SIZE];
if (len != BIP32_EXTKEY_SIZE)
throw std::runtime_error("Invalid extended key size\n");
s.read((char *)&code[0], len);
Decode(code);
}