From 3a11adc7004d21b3dfe028b190d83add31691c55 Mon Sep 17 00:00:00 2001 From: John Moffett Date: Fri, 10 Feb 2023 16:13:40 -0500 Subject: [PATCH] Zero out wallet master key upon lock When an encrypted wallet is locked (for instance via the RPC `walletlock`), the docs indicate that the key is removed from memory. However, the vector (with a secure allocator) is merely cleared. This allows the key to persist indefinitely in memory. Instead, manually fill the bytes with zeroes before clearing. --- src/wallet/wallet.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 5a92dbe428..b709bd9650 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -26,6 +26,7 @@ #include