summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIgor Matuszewski <igor@sequoia-pgp.org>2020-10-08 15:08:00 +0200
committerIgor Matuszewski <igor@sequoia-pgp.org>2020-10-08 15:11:24 +0200
commit57fe5bfd6f3edd76a45e3e52ddec8702d34c0e15 (patch)
treee12a4df6acff0a78cc9fa757baee84959ed660d7
parent0dad1b8dfb8e4cb021fa5094a2f46f848310f7dc (diff)
openpgp: Warn about possible reallocation in mem::Protected
-rw-r--r--openpgp/src/crypto/mem.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/openpgp/src/crypto/mem.rs b/openpgp/src/crypto/mem.rs
index 6b2ed613..102f4db0 100644
--- a/openpgp/src/crypto/mem.rs
+++ b/openpgp/src/crypto/mem.rs
@@ -99,6 +99,9 @@ impl DerefMut for Protected {
impl From<Vec<u8>> for Protected {
fn from(v: Vec<u8>) -> Self {
+ // FIXME(xanewok): This can potentially realloc and leave a lingering
+ // copy of the secret somewhere. It'd be great to explicitly move the
+ // source data by copying it and zeroing it explicitly afterwards.
Protected(v.into_boxed_slice())
}
}