Skip to content

Commit 07685d1

Browse files
committed
Add length check for CExtKey deserialization
1 parent 22e301a commit 07685d1

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/key.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,8 @@ struct CExtKey {
172172
{
173173
unsigned int len = ::ReadCompactSize(s);
174174
unsigned char code[BIP32_EXTKEY_SIZE];
175+
if (len != BIP32_EXTKEY_SIZE)
176+
throw std::runtime_error("Invalid extended key size\n");
175177
s.read((char *)&code[0], len);
176178
Decode(code);
177179
}

0 commit comments

Comments
 (0)