wipeable_string: fix buffer overread

This commit is contained in:
moneromooo-monero 2017-12-23 15:30:04 +00:00
parent 7a9a4a6669
commit 6ccc51f645
No known key found for this signature in database
GPG Key ID: 686F07454D6CEFC3

View File

@ -100,7 +100,7 @@ void wipeable_string::grow(size_t sz, size_t reserved)
wipefunc(buffer.data(), old_sz * sizeof(char)); wipefunc(buffer.data(), old_sz * sizeof(char));
buffer.reserve(reserved); buffer.reserve(reserved);
buffer.resize(sz); buffer.resize(sz);
memcpy(buffer.data(), tmp.get(), sz * sizeof(char)); memcpy(buffer.data(), tmp.get(), old_sz * sizeof(char));
wipefunc(tmp.get(), old_sz * sizeof(char)); wipefunc(tmp.get(), old_sz * sizeof(char));
} }