From a65fad0500bb8b988665e4f2350bf710c8974ff1 Mon Sep 17 00:00:00 2001 From: j-t-1 <120829237+j-t-1@users.noreply.github.com> Date: Fri, 13 Dec 2024 13:03:52 +0000 Subject: [PATCH] Use IMAGE_NUMBEROF_DIRECTORY_ENTRIES Is defined in winnt.h, and pefile set it but was not using it. --- pefile.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pefile.py b/pefile.py index f804678..45ac61e 100644 --- a/pefile.py +++ b/pefile.py @@ -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