Browse Source

limit passphrase length to space for 250 code points in UTF-8

synchronous
Volker Birk 5 years ago
parent
commit
e03d474537
  1. 2
      passphrase_cache.cc
  2. 4
      passphrase_cache.hh

2
passphrase_cache.cc

@ -6,7 +6,7 @@ namespace pEp {
std::lock_guard<std::mutex> 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)

4
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;
};

Loading…
Cancel
Save