re-read internal buffer after moving file's contents
This commit is contained in:
parent
d9024990f9
commit
0640d38627
@ -774,6 +774,16 @@ func (mc *MachoContext) RemoveStrings() {
|
|||||||
copy(dummy, []byte("We R BShield\n"))
|
copy(dummy, []byte("We R BShield\n"))
|
||||||
mc.file.WriteAt(dummy, int64(string_segment.Fileoff()))
|
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)
|
// loop over __TEXT,__text and find all occurances of (adrp, add)
|
||||||
// edit the offset to points to new region
|
// edit the offset to points to new region
|
||||||
// because adrp sets the register to the address page at its address
|
// because adrp sets the register to the address page at its address
|
||||||
|
Loading…
Reference in New Issue
Block a user