mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-19 13:27:35 +02:00
Add length check for CExtKey deserialization
This commit is contained in:
parent
22e301a3d5
commit
07685d1bc1
1 changed files with 2 additions and 0 deletions
|
|
@ -172,6 +172,8 @@ struct CExtKey {
|
||||||
{
|
{
|
||||||
unsigned int len = ::ReadCompactSize(s);
|
unsigned int len = ::ReadCompactSize(s);
|
||||||
unsigned char code[BIP32_EXTKEY_SIZE];
|
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);
|
s.read((char *)&code[0], len);
|
||||||
Decode(code);
|
Decode(code);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue