Remove loops and excessively long chains

pull/3/head
Zach Riggle 11 years ago
parent 02f375a5c1
commit 0bb4a32ea1

@ -15,6 +15,10 @@ def get(address, limit=5):
"""
result = []
for i in range(limit):
# Don't follow cycles, except to stop at the second occurrence.
if result.count(address) >= 2:
break
result.append(address)
try:
address = int(pwndbg.memory.poi(pwndbg.types.ppvoid, address))
@ -36,9 +40,12 @@ def format(value):
# Otherwise, the last element in the chain is the non-pointer value.
# We want to enhance the last pointer value.
else:
elif len(chain) < 6:
enhanced = pwndbg.enhance.enhance(chain[-2])
else:
enhanced = '...'
# Colorize the rest
rest = []
for link in chain[:-1]:

Loading…
Cancel
Save