Skip to content

Commit

Permalink
Display nice error message on unavailable ret2csu (Gallopsled#1991)
Browse files Browse the repository at this point in the history
  • Loading branch information
Arusekk authored and vboxuser committed Sep 10, 2023
1 parent a973461 commit 6cc1f98
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pwnlib/rop/rop.py
Original file line number Diff line number Diff line change
Expand Up @@ -1477,8 +1477,6 @@ def ret2csu(self, edi=Padding('edi'), rsi=Padding('rsi'),
# Find an appropriate, non-library ELF.
# Prioritise non-PIE binaries so we can use _fini
exes = (elf for elf in self.elfs if not elf.library and elf.bits == 64)
if not exes:
log.error('No non-library binaries in [elfs]')

nonpie = csu = None
for elf in exes:
Expand All @@ -1488,6 +1486,8 @@ def ret2csu(self, edi=Padding('edi'), rsi=Padding('rsi'),
nonpie = elf
elif '__libc_csu_init' in elf.symbols:
csu = elf
else:
log.error('No non-library binaries in [elfs]')

if elf.pie:
if nonpie:
Expand Down

0 comments on commit 6cc1f98

Please sign in to comment.