Skip to content

Commit

Permalink
Use IMAGE_NUMBEROF_DIRECTORY_ENTRIES
Browse files Browse the repository at this point in the history
Is defined in winnt.h, and pefile set it but was not using it.
  • Loading branch information
j-t-1 authored Dec 13, 2024
1 parent 4b3b1e2 commit a65fad0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pefile.py
Original file line number Diff line number Diff line change
Expand Up @@ -3306,7 +3306,9 @@ def __parse__(self, fname, data, fast_load):
# if we go beyond that, we assume the number of directories
# is wrong and stop processing
if offset >= (
optional_header_offset + self.OPTIONAL_HEADER.sizeof() + 8 * 16
optional_header_offset
+ self.OPTIONAL_HEADER.sizeof()
+ IMAGE_NUMBEROF_DIRECTORY_ENTRIES * 8
):
break

Expand Down

0 comments on commit a65fad0

Please sign in to comment.