Skip to content

Commit 031bb2e

Browse files
author
bannedit
committed
Fix a backwards disasm bug which stomps on the depth option
1 parent c82bb73 commit 031bb2e

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

lib/rex/ropbuilder/rop.rb

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -197,14 +197,13 @@ def color_pattern(gadget, disasm, addrs, p)
197197
def process_gadgets(rets, num)
198198
ret = {}
199199
gadgets = []
200-
tmp = []
201200
rets.each do |ea|
202201
insn = @disassembler.disassemble_instruction(ea)
203202
next if not insn
204203

205204
xtra = insn.bin_length
206205

207-
1.upto(num) do |x|
206+
num.step(0, -1) do |x|
208207
addr = ea - x
209208

210209
# get the disassembled instruction at this address
@@ -229,11 +228,6 @@ def process_gadgets(rets, num)
229228
addr = addr + di.bin_length
230229
end
231230

232-
if not tmp.include?(ea)
233-
tmp << ea
234-
else
235-
next
236-
end
237231
# otherwise, we create a new tailchunk and add it to the list
238232
ret = {:file => @file, :address => ("0x%08x" % (ea - x)), :raw => buf, :disasm => dasm}
239233
gadgets << ret

0 commit comments

Comments
 (0)