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; + } }