Skip to content

Commit f998ac6

Browse files
theStackfanquake
authored andcommitted
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 bitcoin#14242 (commit d855e4c). Github-Pull: bitcoin#31166 Rebased-From: 559a8dd
1 parent 0773560 commit f998ac6

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/key_io.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,9 @@ CExtKey DecodeExtKey(const std::string& str)
274274
key.Decode(data.data() + prefix.size());
275275
}
276276
}
277+
if (!data.empty()) {
278+
memory_cleanse(data.data(), data.size());
279+
}
277280
return key;
278281
}
279282

0 commit comments

Comments
 (0)