aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJude Taylor <me@jude.bio>2016-08-17 10:24:11 -0700
committerJude Taylor <me@jude.bio>2016-08-17 10:24:11 -0700
commit50c3b5df3204a465338fcb2b000c4bd08b0b7335 (patch)
tree8c5c0bdae6ee37f80221780d69313441c605184e
parentca0bce28512bfa8029cc072bb7154b4b6c50c0a6 (diff)
iterate through fat_headers correctly
-rw-r--r--src/resolve-system-dependencies/resolve-system-dependencies.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/resolve-system-dependencies/resolve-system-dependencies.cc b/src/resolve-system-dependencies/resolve-system-dependencies.cc
index 8502444ba..a5f0cd7b3 100644
--- a/src/resolve-system-dependencies/resolve-system-dependencies.cc
+++ b/src/resolve-system-dependencies/resolve-system-dependencies.cc
@@ -54,7 +54,7 @@ std::set<std::string> runResolver(const Path & filename) {
uint32_t narches = DO_SWAP(should_swap, ((struct fat_header*)obj)->nfat_arch);
for(uint32_t iter = 0; iter < narches; iter++) {
- ptrdiff_t header_offset = (ptrdiff_t)obj + sizeof(struct fat_header);
+ ptrdiff_t header_offset = (ptrdiff_t)obj + sizeof(struct fat_header) * (iter + 1);
struct fat_arch* arch = (struct fat_arch*)header_offset;
if(DO_SWAP(should_swap, arch->cputype) == CPU_TYPE_X86_64) {
mach64_offset = (ptrdiff_t)DO_SWAP(should_swap, arch->offset);