From aaf144c0d278d84148fe380bf80f070c70242dea Mon Sep 17 00:00:00 2001 From: kat Date: Fri, 10 Nov 2023 00:57:45 -0500 Subject: [PATCH] Fix a regression with header rebuilding --- src/ktool/macho.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ktool/macho.py b/src/ktool/macho.py index afe2906..8cd391a 100644 --- a/src/ktool/macho.py +++ b/src/ktool/macho.py @@ -572,7 +572,7 @@ def insert_load_command(self, load_command, index=-1, suffix=None): for i in range(command.nsects): sects.append(Section(None, Struct.create_with_bytes(struct_class, sect_data[i * struct_class.SIZE:( i + 1) * struct_class.SIZE], - "little"))) + "little"), 8 if self.is64 else 4)) seg = SegmentLoadCommand.from_values(isinstance(command, segment_command_64), command.segname, command.vmaddr, command.vmsize, command.fileoff, command.filesize, command.maxprot, command.initprot, command.flags, sects) @@ -640,7 +640,7 @@ def remove_load_command(self, index): for i in range(command.nsects): sects.append(Section(None, Struct.create_with_bytes(struct_class, sect_data[i * struct_class.SIZE:( i + 1) * struct_class.SIZE], - "little"))) + "little"), 8 if self.is64 else 4)) seg = SegmentLoadCommand.from_values(isinstance(command, segment_command_64), command.segname, command.vmaddr, command.vmsize, command.fileoff, command.filesize, command.maxprot, command.initprot, command.flags, sects) @@ -708,7 +708,7 @@ def replace_load_command(self, load_command, index=-1, suffix=None): for i in range(command.nsects): sects.append(Section(None, Struct.create_with_bytes(struct_class, sect_data[i * struct_class.SIZE:( i + 1) * struct_class.SIZE], - "little"))) + "little"), 8 if self.is64 else 4)) seg = SegmentLoadCommand.from_values(isinstance(command, segment_command_64), command.segname, command.vmaddr, command.vmsize, command.fileoff, command.filesize, command.maxprot, command.initprot, command.flags, sects)