Merge pull request #515 from DrChat/disc_image_crash_fix

Fix an overflow crash in DiscImageDevice::Verify
This commit is contained in:
Ben Vanik 2016-01-14 13:40:04 -08:00
commit 3f6784b10c
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;
}