Correct incorrect bounds checking.

Review URL: http://breakpad.appspot.com/319002

git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@874 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
qsr@chromium.org 2011-10-20 15:39:57 +00:00
parent 446616ee22
commit 70698339f6

View file

@ -107,11 +107,11 @@ bool MachoWalker::ReadBytes(void *buffer, size_t size, off_t offset) {
if (memory_) {
bool result = true;
if (offset + size > memory_size_) {
if (offset >= memory_size_)
return false;
size = memory_size_ - offset;
result = false;
}
if (size < 0)
return false;
memcpy(buffer, static_cast<char *>(memory_) + offset, size);
return result;
} else {