epee: basic sanity check on allocation size from untrusted source

Reported by guidov
This commit is contained in:
moneromooo-monero 2019-03-08 12:02:21 +00:00 committed by wowario
parent 94390f8364
commit 307bd8f5ae
No known key found for this signature in database
GPG Key ID: 24DCBE762DE9C111
1 changed files with 1 additions and 0 deletions

View File

@ -136,6 +136,7 @@ namespace epee
//for pod types
array_entry_t<type_name> sa;
size_t size = read_varint();
CHECK_AND_ASSERT_THROW_MES(size <= m_count, "Size sanity check failed");
sa.reserve(size);
//TODO: add some optimization here later
while(size--)