aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Schnelli <dev@jonasschnelli.ch>2017-08-17 21:54:23 +0200
committerJonas Schnelli <dev@jonasschnelli.ch>2017-08-17 21:54:23 +0200
commit07685d1bc1b0b815c00a68a5b7b335ffa0d4d90d (patch)
tree6a4ba8d61c0f0b8a95df156c0878996d01991837
parent22e301a3d56dc9e6878380ee92c7d19ca43119d2 (diff)
Add length check for CExtKey deserialization
-rw-r--r--src/key.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/key.h b/src/key.h
index 2c6f151727..151e63531b 100644
--- a/src/key.h
+++ b/src/key.h
@@ -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);
}