Browse Source

Add length check for CExtKey deserialization

0.16
Jonas Schnelli 7 years ago
parent
commit
07685d1bc1
No known key found for this signature in database
GPG Key ID: 1EB776BB03C7922D
  1. 2
      src/key.h

2
src/key.h

@ -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…
Cancel
Save