Skip to content

Commit

Permalink
key: clear out secret data in DecodeExtKey
Browse files Browse the repository at this point in the history
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
d855e4c).
  • Loading branch information
theStack committed Oct 27, 2024
1 parent 2a52718 commit 559a8dd
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/key_io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 559a8dd

Please sign in to comment.