File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22
33.global start
44start:
5+ // Save $ra
56 addiu $sp, -4
67 sw $ra, 0 ($sp)
8+
9+ // Get $pc using bal
710 bal code
811 nop
912code:
1619 jalr $v0
1720 nop
1821
22+ // Restore $ra
1923 lw $ra, 0 ($sp)
2024 addiu $sp, 4
2125 nop
2226
27+ // Jump over the printed string, to ensure we can run
28+ // another primitive after this one.
29+ b end_of_code
30+
2331print_string:
2432 .asciiz PRINT_STRING
33+ .align 2
34+
35+ end_of_code:
36+ nop
Original file line number Diff line number Diff line change @@ -128,9 +128,7 @@ def test_print_reaches_end(
128128 stack_address
129129 )
130130
131- end_of_code = shellcode .find (string_to_print .encode ())
132-
133- print_mu .emu_start (shellcode_address , shellcode_address + end_of_code )
131+ print_mu .emu_start (shellcode_address , shellcode_address + len (shellcode ))
134132
135133 assert (stack_address + 0x2000 ) == print_mu .reg_read (UC_MIPS_REG_29 )
136134
@@ -157,6 +155,4 @@ def test_print_is_pic(
157155 stack_address
158156 )
159157
160- end_of_code = shellcode .find (string_to_print .encode ())
161-
162- print_mu .emu_start (shellcode_run_addr , shellcode_run_addr + end_of_code )
158+ print_mu .emu_start (shellcode_run_addr , shellcode_run_addr + len (shellcode ))
You can’t perform that action at this time.
0 commit comments