diff options
author | Pieter Wuille <pieter@wuille.net> | 2021-08-30 12:02:04 -0400 |
---|---|---|
committer | Pieter Wuille <pieter@wuille.net> | 2021-08-30 12:02:04 -0400 |
commit | 56a42f10f452f0ac0e3e333646a8effcbebf6b30 (patch) | |
tree | bf3c870669316ba912102115585f0c22c004a932 /src/pubkey.cpp | |
parent | 7be143a960e2bb9ac81144f55c45731c1bb209c5 (diff) | |
download | bitcoin-56a42f10f452f0ac0e3e333646a8effcbebf6b30.tar.xz |
Stricter BIP32 decoding and test vector 5
Diffstat (limited to 'src/pubkey.cpp')
-rw-r--r-- | src/pubkey.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/pubkey.cpp b/src/pubkey.cpp index 75202e7cf4..a393153ff8 100644 --- a/src/pubkey.cpp +++ b/src/pubkey.cpp @@ -333,6 +333,7 @@ void CExtPubKey::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); pubkey.Set(code+41, code+BIP32_EXTKEY_SIZE); + if ((nDepth == 0 && (nChild != 0 || ReadLE32(vchFingerprint) != 0)) || !pubkey.IsFullyValid()) pubkey = CPubKey(); } bool CExtPubKey::Derive(CExtPubKey &out, unsigned int _nChild) const { |