Skip to content

Commit

Permalink
Correct allocation.limit_'s type before swapping
Browse files Browse the repository at this point in the history
When signing a ppc7540 binary, the dataoff would overflow to 0 and
really mess things up.
  • Loading branch information
CRKatri committed Dec 14, 2023
1 parent eb44f02 commit 743cbb2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ldid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1677,7 +1677,7 @@ static void Allocate(const void *idata, size_t isize, std::streambuf &output, co
linkedit_data_command signature;
signature.cmd = mach_header.Swap(LC_CODE_SIGNATURE);
signature.cmdsize = mach_header.Swap(uint32_t(sizeof(signature)));
signature.dataoff = mach_header.Swap(allocation.limit_);
signature.dataoff = mach_header.Swap(uint32_t(allocation.limit_));
signature.datasize = mach_header.Swap(allocation.alloc_);
commands.push_back(std::string(reinterpret_cast<const char *>(&signature), sizeof(signature)));
}
Expand Down

0 comments on commit 743cbb2

Please sign in to comment.