Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CodeSign: pad LINKEDIT to multiple of page size when reading (#66)
When we are creating a new CodeSignature, we align its offset up to a multiple of the page size; we then read the existing LINKEDIT section (and the entire beginning of the file, for signing) based on the location of that code signature. If the existing LINKEDIT section's end was not page-aligned, we get an EOF when attempting to read up to the page-aligned flie size, causing signing to fail. This change limits our read to the actual size of the file (or LINKEDIT section, at least), while keeping the buffer we read into the correct size (and therefore implicitly padding it with zeroes, which will get written out when we rewrite the LINKEDIT section and new signature).
- Loading branch information