Navigation Menu

Skip to content

Commit

Permalink
Do not truncate the ELF file when saving to the same path
Browse files Browse the repository at this point in the history
  • Loading branch information
zachriggle committed Jan 20, 2017
1 parent 3e4a1bc commit 31cd98a
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions pwnlib/elf/elf.py
Expand Up @@ -874,14 +874,8 @@ def save(self, path=None):
"""
if path is None:
path = self.path

old = self.stream.tell()

with open(path,'wb+') as fd:
self.stream.seek(0)
fd.write(self.get_data())

self.stream.seek(old)
data = self.get_data()
misc.write(path, data)

def get_data(self):
"""get_data() -> bytes
Expand Down

0 comments on commit 31cd98a

Please sign in to comment.