diff --git a/passphrase_cache.cc b/passphrase_cache.cc index 7fbe209..05771d4 100644 --- a/passphrase_cache.cc +++ b/passphrase_cache.cc @@ -6,7 +6,7 @@ namespace pEp { std::lock_guard lock(_mtx); while (_cache.size() >= _max_size) _cache.pop_front(); - _cache.push_back({passphrase, clock::now()}); + _cache.emplace_back(cache_entry(passphrase, clock::now())); } bool PassphraseCache::for_each_passphrase(const passphrase_callee& callee) diff --git a/passphrase_cache.hh b/passphrase_cache.hh index a85940a..d44d02b 100644 --- a/passphrase_cache.hh +++ b/passphrase_cache.hh @@ -13,6 +13,10 @@ namespace pEp { using duration = clock::duration; struct cache_entry { + static const size_t max_len = 250 * 4; + cache_entry(std::string p, time_point t) : + passphrase(p, 0, max_len), tp(t) { } + std::string passphrase; time_point tp; };