Fix an overflow crash in DiscImageDevice::Verify

This commit is contained in:
Dr. Chat 2016-01-14 15:18:41 -06:00
parent 9473f20c7f
commit e8719dd949
1 changed files with 4 additions and 0 deletions

View File

@ -84,6 +84,10 @@ DiscImageDevice::Error DiscImageDevice::Verify(ParseState* state) {
}
bool DiscImageDevice::VerifyMagic(ParseState* state, size_t offset) {
if (offset >= state->size) {
return false;
}
// Simple check to see if the given offset contains the magic value.
return std::memcmp(state->ptr + offset, "MICROSOFT*XBOX*MEDIA", 20) == 0;
}