aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/common/mac/macho_walker.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/common/mac/macho_walker.cc b/src/common/mac/macho_walker.cc
index 00fde03e..26535bc2 100644
--- a/src/common/mac/macho_walker.cc
+++ b/src/common/mac/macho_walker.cc
@@ -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 {