mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-16 13:01:19 +02:00
extended keys: fail to derive too large depth instead of wrapping around
This issue was reported to me by Marco Falke, and found with the descriptor_parse fuzz target.
This commit is contained in:
parent
8dc6670ce1
commit
fb9faffae3
3 changed files with 20 additions and 0 deletions
|
|
@ -333,6 +333,7 @@ bool CKey::Derive(CKey& keyChild, ChainCode &ccChild, unsigned int nChild, const
|
|||
}
|
||||
|
||||
bool CExtKey::Derive(CExtKey &out, unsigned int _nChild) const {
|
||||
if (nDepth == std::numeric_limits<unsigned char>::max()) return false;
|
||||
out.nDepth = nDepth + 1;
|
||||
CKeyID id = key.GetPubKey().GetID();
|
||||
memcpy(out.vchFingerprint, &id, 4);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue