diff --git a/snapshot/ios/module_snapshot_ios.cc b/snapshot/ios/module_snapshot_ios.cc index 824ad8a5..8b251eb9 100644 --- a/snapshot/ios/module_snapshot_ios.cc +++ b/snapshot/ios/module_snapshot_ios.cc @@ -87,25 +87,26 @@ bool ModuleSnapshotIOS::FinishInitialization() { cmd_index <= header->ncmds && cumulative_cmd_size < header->sizeofcmds; ++cmd_index, cumulative_cmd_size += command->cmdsize) { if (command->cmd == LC_SEGMENT_64) { - segment_command_64* segment = - reinterpret_cast(&command); + const segment_command_64* segment = + reinterpret_cast(command); if (strcmp(segment->segname, SEG_TEXT) == 0) { size_ = segment->vmsize; } } else if (command->cmd == LC_ID_DYLIB) { - dylib_command* dylib = reinterpret_cast(&command); + const dylib_command* dylib = + reinterpret_cast(command); dylib_version_ = dylib->dylib.current_version; } else if (command->cmd == LC_SOURCE_VERSION) { - source_version_command* source_version = - reinterpret_cast(&command); + const source_version_command* source_version = + reinterpret_cast(command); source_version_ = source_version->version; } else if (command->cmd == LC_UUID) { - uuid_command* uuid = reinterpret_cast(&command); + const uuid_command* uuid = reinterpret_cast(command); uuid_.InitializeFromBytes(uuid->uuid); } command = reinterpret_cast( - reinterpret_cast(command + command->cmdsize)); + reinterpret_cast(command) + command->cmdsize); // TODO(justincohen): Warn-able things: // - Bad Mach-O magic (and give up trying to process the module)