Skip to content

Commit

Permalink
Null character bug
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuamitchener committed Sep 11, 2020
1 parent 6d88c6a commit 3eff6ef
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion dashmips/syscalls/print_syscalls.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def print_unsigned(program: MipsProgram):
def print_ascii(program: MipsProgram):
"""Print Word in Ascii. $a0 = word to print."""
ascii_string = repr(bytesify(program.registers["$a0"] & 0xFFFFFFFF)).replace("\\x00", "0\\")[2:-1][::-1]
print_unbuffered("%s" % ("\\0" * (4 - len(ascii_string))) + ascii_string)
print_unbuffered("%s" % ("\\0" * (4 - len(ascii_string.replace("\\0", "0")))) + ascii_string)


@mips_syscall(10)
Expand Down

0 comments on commit 3eff6ef

Please sign in to comment.