Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Mathias Svensson authored Jun 11, 2018
1 parent 338fbeb commit 8e704e7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pwnlib/elf/elf.py
Original file line number Diff line number Diff line change
Expand Up @@ -926,10 +926,12 @@ def search(self, needle, writable = False):
for seg in segments:
addr = seg.header.p_vaddr
memsz = seg.header.p_memsz
zeroed = memsz - seg.header.p_filesz
filesz = seg.header.p_filesz
zeroed = memsz - filesz
offset = seg.header.p_offset
data = self.mmap[offset:offset+memsz]
data = self.mmap[offset:offset+filesz]
data += '\x00' * zeroed
assert len(data) == memsz
offset = 0
while True:
offset = data.find(needle, offset)
Expand Down

0 comments on commit 8e704e7

Please sign in to comment.