wipeable_string: ignore reserve size less than actual size

This was asserting, but stoffu pointed out the std::string standard
considers this ok and ignorable
This commit is contained in:
moneromooo-monero 2017-12-19 14:00:41 +00:00
parent 9ec44a2b06
commit 5f801b6adf
No known key found for this signature in database
GPG Key ID: 686F07454D6CEFC3
1 changed files with 1 additions and 2 deletions

View File

@ -85,9 +85,8 @@ void wipeable_string::wipe()
void wipeable_string::grow(size_t sz, size_t reserved)
{
CHECK_AND_ASSERT_THROW_MES(wipefunc, "wipefunc is not set");
if (reserved == 0)
if (reserved < sz)
reserved = sz;
CHECK_AND_ASSERT_THROW_MES(reserved >= sz, "reserved < sz");
if (reserved <= buffer.capacity())
{
buffer.resize(sz);