aboutsummaryrefslogtreecommitdiff
path: root/src/key.cpp
diff options
context:
space:
mode:
authorPieter Wuille <pieter@wuille.net>2021-08-30 12:02:04 -0400
committerPieter Wuille <pieter@wuille.net>2021-08-30 12:02:04 -0400
commit56a42f10f452f0ac0e3e333646a8effcbebf6b30 (patch)
treebf3c870669316ba912102115585f0c22c004a932 /src/key.cpp
parent7be143a960e2bb9ac81144f55c45731c1bb209c5 (diff)
downloadbitcoin-56a42f10f452f0ac0e3e333646a8effcbebf6b30.tar.xz
Stricter BIP32 decoding and test vector 5
Diffstat (limited to 'src/key.cpp')
-rw-r--r--src/key.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/key.cpp b/src/key.cpp
index 7bef3d529b..40df248e02 100644
--- a/src/key.cpp
+++ b/src/key.cpp
@@ -357,6 +357,7 @@ void CExtKey::Decode(const unsigned char code[BIP32_EXTKEY_SIZE]) {
nChild = (code[5] << 24) | (code[6] << 16) | (code[7] << 8) | code[8];
memcpy(chaincode.begin(), code+9, 32);
key.Set(code+42, code+BIP32_EXTKEY_SIZE, true);
+ if ((nDepth == 0 && (nChild != 0 || ReadLE32(vchFingerprint) != 0)) || code[41] != 0) key = CKey();
}
bool ECC_InitSanityCheck() {