Set valid to false if size is bogus

This is to prevent callers from parsing bogus sizes. If they listen to
the -1 sentinel value, at least...
This commit is contained in:
Misa
2020-08-14 01:50:41 -07:00
committed by Ethan Lee
parent 7903b8967e
commit 6991b2045d

View File

@@ -98,10 +98,12 @@ bool binaryBlob::unPackBinary(const char* name)
}
if (m_headers[i].size < 1)
{
m_headers[i].valid = false;
continue; /* Must be nonzero and positive */
}
if ((offset + m_headers[i].size) > size)
{
m_headers[i].valid = false;
continue; /* Bogus size value */
}