Skip to content

Commit

Permalink
fix PE.get_data
Browse files Browse the repository at this point in the history
Fix a situation when `length` passed to .get_data is 0 - expected results will be an empty  string but currently if rva is outside any section returned data will be unbounded
  • Loading branch information
mak authored Jul 19, 2023
1 parent 593d094 commit 8a2aada
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pefile.py
Original file line number Diff line number Diff line change
Expand Up @@ -6409,10 +6409,10 @@ def get_data(self, rva=0, length=None):

s = self.get_section_by_rva(rva)

if length:
end = rva + length
else:
if length is None:
end = None
else:
end = rva + length

if not s:
if rva < len(self.header):
Expand Down

0 comments on commit 8a2aada

Please sign in to comment.