diff --git a/macho-go/pkg/ios/macho/edit.go b/macho-go/pkg/ios/macho/edit.go index 748c15e..8cdce51 100644 --- a/macho-go/pkg/ios/macho/edit.go +++ b/macho-go/pkg/ios/macho/edit.go @@ -774,6 +774,16 @@ func (mc *MachoContext) RemoveStrings() { copy(dummy, []byte("We R BShield\n")) mc.file.WriteAt(dummy, int64(string_segment.Fileoff())) + // TODO: erase old strings + + // re-read internal buffer + last, _ := mc.file.Seek(0, io.SeekEnd) + mc.buf = make([]byte, last) + mc.file.Seek(0, io.SeekStart) + if _, err := io.ReadFull(mc.file, mc.buf); err != nil { + // panic? + } + // loop over __TEXT,__text and find all occurances of (adrp, add) // edit the offset to points to new region // because adrp sets the register to the address page at its address