Skip to content

Commit

Permalink
refactor aarch64 pushstr_array, use "xzr" reg
Browse files Browse the repository at this point in the history
  • Loading branch information
patryk4815 committed Jan 3, 2024
1 parent bc6228e commit c9bc555
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pwnlib/shellcraft/templates/aarch64/pushstr_array.asm
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@ need_fix_alligment = len(array) % 2 == 1

/* push null terminator */
${shellcraft.mov(register2, 0)}
str ${register2}, [sp, #-16]!
str xzr, [sp, #-16]!

/* push pointers onto the stack */
%for i, value in enumerate(reversed(array)):
${shellcraft.mov(register1, 8 + ((i+1)*8 + string.index(value)))}
${shellcraft.mov(register1, (i+2)*8 + string.index(value))}
add ${register1}, sp, ${register1}
%if i % 2 == 0:
str ${register2}, [sp, #-16]! /* allocate zeros */
str xzr, [sp, #-16]! /* allocate zeros */
str ${register1}, [sp, #8]!
%else:
sub sp, sp, #8
Expand Down

0 comments on commit c9bc555

Please sign in to comment.