From: Remi Gacogne Date: Tue, 17 Jan 2023 16:52:09 +0000 (+0100) Subject: credentials: Explicitly clear credentials once they have been moved X-Git-Tag: dnsdist-1.8.0-rc1~108^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F12428%2Fhead;p=thirdparty%2Fpdns.git credentials: Explicitly clear credentials once they have been moved --- diff --git a/pdns/credentials.cc b/pdns/credentials.cc index ef37eaee6c..b086788a5f 100644 --- a/pdns/credentials.cc +++ b/pdns/credentials.cc @@ -62,6 +62,7 @@ uint64_t const CredentialsHolder::s_defaultBlockSize{8U}; /* r */ SensitiveData::SensitiveData(std::string&& data) : d_data(std::move(data)) { + data.clear(); #ifdef HAVE_LIBSODIUM sodium_mlock(d_data.data(), d_data.size()); #endif @@ -70,6 +71,7 @@ SensitiveData::SensitiveData(std::string&& data) : SensitiveData& SensitiveData::operator=(SensitiveData&& rhs) { d_data = std::move(rhs.d_data); + rhs.clear(); return *this; }