From ea11c621649c73a35ba650c40d0f3b76447fe5fd Mon Sep 17 00:00:00 2001 From: mingjun_gu Date: Fri, 23 Mar 2018 14:35:50 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3LC=5FCODE=5FSIGNATURE?= =?UTF-8?q?=E4=B8=8D=E5=AD=98=E5=9C=A8=E6=97=B6=E5=86=99=E5=85=A5=E5=BC=82?= =?UTF-8?q?=E5=B8=B8=E6=95=B0=E6=8D=AE=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/restore-symbol.m | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/source/restore-symbol.m b/source/restore-symbol.m index 3dae5fc..47b84ba 100644 --- a/source/restore-symbol.m +++ b/source/restore-symbol.m @@ -177,13 +177,14 @@ void restore_symbol(NSString * inpath, NSString *outpath, NSString *jsonPath, bo } } - struct linkedit_data_command *command = (struct linkedit_data_command *)((char *)outData.mutableBytes + codesignature.commandOffset); - uint32_t tmp_offset = command -> dataoff + increase_size_all_without_padding; - uint32_t final_offset = vm_addr_round(tmp_offset, 16); - - string_table_padding = final_offset - tmp_offset; - command -> dataoff = final_offset; - + if (codesignature) { + struct linkedit_data_command *command = (struct linkedit_data_command *)((char *)outData.mutableBytes + codesignature.commandOffset); + uint32_t tmp_offset = command -> dataoff + increase_size_all_without_padding; + uint32_t final_offset = vm_addr_round(tmp_offset, 16); + + string_table_padding = final_offset - tmp_offset; + command -> dataoff = final_offset; + } }