bfd_mach_o_dylinker_command *cmd = &command->command.dylinker;
struct mach_o_str_command_external raw;
unsigned int nameoff;
+ unsigned int namelen;
if (bfd_seek (abfd, command->offset + BFD_MACH_O_LC_SIZE, SEEK_SET) != 0
|| bfd_bread (&raw, sizeof (raw), abfd) != sizeof (raw))
nameoff = bfd_h_get_32 (abfd, raw.str);
- cmd->name_offset = command->offset + nameoff;
- cmd->name_len = command->len - nameoff;
- cmd->name_str = bfd_alloc (abfd, cmd->name_len);
+ cmd->name_offset = nameoff;
+ namelen = command->len - nameoff;
+ nameoff += command->offset;
+ cmd->name_str = bfd_alloc (abfd, namelen);
if (cmd->name_str == NULL)
return FALSE;
- if (bfd_seek (abfd, cmd->name_offset, SEEK_SET) != 0
- || bfd_bread (cmd->name_str, cmd->name_len, abfd) != cmd->name_len)
+ if (bfd_seek (abfd, nameoff, SEEK_SET) != 0
+ || bfd_bread (cmd->name_str, namelen, abfd) != namelen)
return FALSE;
return TRUE;
}
bfd_mach_o_dylib_command *cmd = &command->command.dylib;
struct mach_o_dylib_command_external raw;
unsigned int nameoff;
+ unsigned int namelen;
switch (command->type)
{
cmd->compatibility_version = bfd_h_get_32 (abfd, raw.compatibility_version);
cmd->name_offset = command->offset + nameoff;
- cmd->name_len = command->len - nameoff;
- cmd->name_str = bfd_alloc (abfd, cmd->name_len);
+ namelen = command->len - nameoff;
+ cmd->name_str = bfd_alloc (abfd, namelen);
if (cmd->name_str == NULL)
return FALSE;
if (bfd_seek (abfd, cmd->name_offset, SEEK_SET) != 0
- || bfd_bread (cmd->name_str, cmd->name_len, abfd) != cmd->name_len)
+ || bfd_bread (cmd->name_str, namelen, abfd) != namelen)
return FALSE;
return TRUE;
}
bfd_mach_o_fvmlib_command *fvm = &command->command.fvmlib;
struct mach_o_fvmlib_command_external raw;
unsigned int nameoff;
+ unsigned int namelen;
if (bfd_seek (abfd, command->offset + BFD_MACH_O_LC_SIZE, SEEK_SET) != 0
|| bfd_bread (&raw, sizeof (raw), abfd) != sizeof (raw))
fvm->header_addr = bfd_h_get_32 (abfd, raw.header_addr);
fvm->name_offset = command->offset + nameoff;
- fvm->name_len = command->len - nameoff;
- fvm->name_str = bfd_alloc (abfd, fvm->name_len);
+ namelen = command->len - nameoff;
+ fvm->name_str = bfd_alloc (abfd, namelen);
if (fvm->name_str == NULL)
return FALSE;
if (bfd_seek (abfd, fvm->name_offset, SEEK_SET) != 0
- || bfd_bread (fvm->name_str, fvm->name_len, abfd) != fvm->name_len)
+ || bfd_bread (fvm->name_str, namelen, abfd) != namelen)
return FALSE;
return TRUE;
}
typedef struct bfd_mach_o_dylinker_command
{
- unsigned long name_offset; /* Offset to library's path name. */
- unsigned long name_len; /* Offset to library's path name. */
+ unsigned int name_offset; /* Offset to library's path name. */
char *name_str;
}
bfd_mach_o_dylinker_command;
typedef struct bfd_mach_o_dylib_command
{
- unsigned long name_offset; /* Offset to library's path name. */
- unsigned long name_len; /* Offset to library's path name. */
+ unsigned int name_offset; /* Offset to library's path name. */
unsigned long timestamp; /* Library's build time stamp. */
unsigned long current_version; /* Library's current version number. */
unsigned long compatibility_version; /* Library's compatibility vers number. */
typedef struct bfd_mach_o_fvmlib_command
{
unsigned int name_offset;
- unsigned int name_len;
char *name_str;
unsigned int minor_version;
unsigned int header_addr;