overwrite old cstring data with random
This commit is contained in:
parent
7fa3ba0b7d
commit
9cdf9f0ff5
@ -769,11 +769,17 @@ func (mc *MachoContext) RemoveStrings() {
|
||||
mc.file.WriteAt(old_linkedit, int64(edit_segment.Fileoff()))
|
||||
|
||||
// prepare dummy bytes into new string segment, 0 for now
|
||||
// this is a way to divert their effort, writing fake strings
|
||||
// will be written again at runtime
|
||||
dummy := make([]byte, edit_segment.Fileoff() - string_segment.Fileoff())
|
||||
copy(dummy, []byte("We R BShield\n"))
|
||||
mc.file.WriteAt(dummy, int64(string_segment.Fileoff()))
|
||||
|
||||
// TODO: erase old strings
|
||||
cstring_start := uint64(cstring.Offset())
|
||||
random := make([]byte, cstring.Size())
|
||||
rand.Read(random)
|
||||
mc.file.WriteAt(random, int64(cstring_start))
|
||||
|
||||
// re-read internal buffer
|
||||
last, _ := mc.file.Seek(0, io.SeekEnd)
|
||||
@ -870,7 +876,7 @@ func (mc *MachoContext) RemoveStrings() {
|
||||
value := C.MakeRebaseFixupOpcode(C.int(symbol.next), C.ulonglong(target), C.ulonglong(high8))
|
||||
v := make([]byte, 8)
|
||||
mc.byteorder.PutUint64(v, uint64(value))
|
||||
fmt.Printf("change to rebase at %x\n", symbol.file_address)
|
||||
fmt.Printf("string rebase change at %x\n", symbol.file_address)
|
||||
mc.file.WriteAt(v, int64(symbol.file_address))
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user