aboutsummaryrefslogtreecommitdiff
path: root/contrib/epee/src/wipeable_string.cpp
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2017-12-19 14:03:35 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2017-12-19 14:06:42 +0000
commit6c94516fb49f450f291c2092b829f3094215cf04 (patch)
tree3da169933fb461079dd0169907e3504126f0c126 /contrib/epee/src/wipeable_string.cpp
parentwipeable_string: ignore reserve size less than actual size (diff)
downloadmonero-6c94516fb49f450f291c2092b829f3094215cf04.tar.xz
wipeable_string: move a wipe from reserve to grow
That way, all implicit wipes ends up in grow, which is more robust
Diffstat (limited to '')
-rw-r--r--contrib/epee/src/wipeable_string.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/contrib/epee/src/wipeable_string.cpp b/contrib/epee/src/wipeable_string.cpp
index 2ec1e5469..894c47bbd 100644
--- a/contrib/epee/src/wipeable_string.cpp
+++ b/contrib/epee/src/wipeable_string.cpp
@@ -89,6 +89,8 @@ void wipeable_string::grow(size_t sz, size_t reserved)
reserved = sz;
if (reserved <= buffer.capacity())
{
+ if (sz < buffer.size())
+ wipefunc(buffer.data() + sz, buffer.size() - sz);
buffer.resize(sz);
return;
}
@@ -115,9 +117,6 @@ void wipeable_string::pop_back()
void wipeable_string::resize(size_t sz)
{
- CHECK_AND_ASSERT_THROW_MES(wipefunc, "wipefunc is not set");
- if (sz < buffer.size())
- wipefunc(buffer.data() + sz, buffer.size() - sz);
grow(sz);
}