From c50ba6614d81fc3eab55b389782a1d864d6e12d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Grisez?= Date: Fri, 17 Nov 2017 09:33:09 +0100 Subject: [PATCH] Fills the body of Content objects on destruction This commit is a duplicate of bd08e5940c7358a945fff0d0e47678440a1b4ba5 in master --- src/content/content.cpp | 7 +++++++ src/content/content.h | 1 + 2 files changed, 8 insertions(+) diff --git a/src/content/content.cpp b/src/content/content.cpp index e94c0ecee..359d70fb4 100644 --- a/src/content/content.cpp +++ b/src/content/content.cpp @@ -53,6 +53,13 @@ Content::Content (ContentPrivate &p) : ClonableObject(p) { } +Content::~Content () { + L_D(); + /* Fills the body with zeros before releasing since it may contain + private data like cipher keys or decoded messages. */ + d->body.assign(d->body.size(), 0); +} + Content &Content::operator= (const Content &src) { L_D(); if (this != &src) { diff --git a/src/content/content.h b/src/content/content.h index 4635898bf..d51c51e7e 100644 --- a/src/content/content.h +++ b/src/content/content.h @@ -40,6 +40,7 @@ public: Content (); Content (const Content &src); Content (Content &&src); + ~Content (); Content &operator= (const Content &src); Content &operator= (Content &&src);