]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
ukify: Use length= instead of ignore_padding= in inspect
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Thu, 10 Aug 2023 15:05:55 +0000 (17:05 +0200)
committerLuca Boccassi <luca.boccassi@gmail.com>
Thu, 10 Aug 2023 18:35:21 +0000 (19:35 +0100)
ignore_padding= was only added in a recent version of pefile. Let's
set length= to the virtual size instead which is what ignore_padding
does behind the scenes so we're compatible with older versions of
pefile.

src/ukify/ukify.py

index 0ddf56ae5e2dabab308608ff9d8bfa7f9b70a36d..10a464bb1a337ccea4eb2f0b55f717b45972a7ef 100755 (executable)
@@ -958,8 +958,9 @@ def inspect_section(opts, section):
 
     ttype = config.output_mode if config else DEFAULT_SECTIONS_TO_SHOW.get(name, 'binary')
 
-    data = section.get_data(ignore_padding=True)
     size = section.Misc_VirtualSize
+    # TODO: Use ignore_padding once we can depend on a newer version of pefile
+    data = section.get_data(length=size)
     digest = sha256(data).hexdigest()
 
     struct = {