Merge pull request #2995

6ccc51f6 wipeable_string: fix buffer overread (moneromooo-monero)
This commit is contained in:
Riccardo Spagni 2018-01-10 11:53:42 +01:00
commit 1c11ec71b5
No known key found for this signature in database
GPG Key ID: 55432DF31CCD4FCD
1 changed files with 1 additions and 1 deletions

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