key: clear out secret data in DecodeExtKey

Same as in `DecodeSecret`, we should also clear out the secret data from
the vector resulting from the Base58Check parsing for xprv keys. Note
that the if condition is needed in order to avoid UB, see #14242 (commit
d855e4cac8).

Github-Pull: #31166
Rebased-From: 559a8dd9c0
This commit is contained in:
Sebastian Falbesoner 2024-10-27 15:31:48 +01:00 committed by fanquake
parent 0773560abf
commit f998ac6286
No known key found for this signature in database
GPG key ID: 2EEB9F5CC09526C1

View file

@ -274,6 +274,9 @@ CExtKey DecodeExtKey(const std::string& str)
key.Decode(data.data() + prefix.size());
}
}
if (!data.empty()) {
memory_cleanse(data.data(), data.size());
}
return key;
}