ruby-macho 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/macho/file.rb +3 -2
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 686c8eeee9cd964f7c1112259c64ba6f37650262
4
- data.tar.gz: 9c7a05e36acc9b2120263e3847ca0dbb8e8f9fd9
3
+ metadata.gz: ce4c78f7559d54d07390f535cfe67da8b747ca9d
4
+ data.tar.gz: 5e1da197dae79a1d084781898e01c5576704b54e
5
5
  SHA512:
6
- metadata.gz: ff579faa1788421e587e995b4434ff2e8ef0f5491b33c4d599577ea70fff6ac7ce3b3e4eea166d5e5e94cd5128f3050adab90b38949fdc854419fbacfa059aa2
7
- data.tar.gz: 107c76d944b6aa7987ac1c0299f2d49ee8e48eb8a4b8a9fa046ea9fbd6821586910c0892792c14c3aefb094b02d0a2a60c8d811cddc2c3f73309933f330c6b2c
6
+ metadata.gz: 5534f18bf42c95de58c33abb7a98521496cc1258a99049784a1030d145efaaf59755575db792eab1ad714da02a003eebee0c97c9f7c8f301df12b794fabb4c48
7
+ data.tar.gz: e5f681c4c01f9105dfcb087d36d74870ea0fbef69336bfd5286ab8787d7e1c2555c049699510c38fa42c6ccb1bb876cbe177e3db7ebfec86334824721a7199e0
data/lib/macho/file.rb CHANGED
@@ -103,7 +103,7 @@ module MachO
103
103
 
104
104
  dylib_id = @raw_data.slice(offset + stroffset...offset + cmdsize).unpack("Z*").first
105
105
 
106
- dylib_id
106
+ dylib_id.delete("\x00")
107
107
  end
108
108
 
109
109
  def dylib_id=(new_id)
@@ -124,6 +124,7 @@ module MachO
124
124
  new_sizeofcmds = header[:sizeofcmds]
125
125
  dylib_id_cmd = command('LC_ID_DYLIB').first
126
126
  old_id = dylib_id
127
+ new_id = new_id.dup
127
128
 
128
129
  new_pad = Utils.round(new_id.size, cmd_round) - new_id.size
129
130
  old_pad = Utils.round(old_id.size, cmd_round) - old_id.size
@@ -161,7 +162,7 @@ module MachO
161
162
  @raw_data[dylib_id_cmd.offset + 4, 4] = [new_size].pack("V")
162
163
 
163
164
  # delete the old id
164
- @raw_data.slice!(dylib_id_cmd.offset + dylib_id_cmd.name...dylib_id_cmd.offset + dylib_id_cmd.cmdsize)
165
+ @raw_data.slice!(dylib_id_cmd.offset + dylib_id_cmd.name...dylib_id_cmd.offset + dylib_id_cmd.class.bytesize + old_id.size)
165
166
 
166
167
  # insert the new id
167
168
  @raw_data.insert(dylib_id_cmd.offset + dylib_id_cmd.name, new_id)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-macho
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Woodruff