Skip to content

Commit

Permalink
more suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
therealdreg committed Jul 21, 2023
1 parent 722f65b commit dafde6a
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions gef.py
Original file line number Diff line number Diff line change
Expand Up @@ -6073,8 +6073,8 @@ def do_invoke(self, _: List[str], **kwargs: Any) -> None:

if len(nop) > total_bytes or total_bytes % len(nop):
warn(f"Patching {total_bytes} bytes at {address:#x} will result in LAST-NOP "
f"(byte nr {total_bytes % len(nop):#x}) broken and may cause a crash or break disassembly. "
f"Use --f (force) to ignore this warning")
f"(byte nr {total_bytes % len(nop):#x}) broken and may cause a crash or "
f"break disassembly. Use --f (force) to ignore this warning")
if not force_flag:
return

Expand All @@ -6090,15 +6090,16 @@ def do_invoke(self, _: List[str], **kwargs: Any) -> None:

if final_ins_end_addr != target_end_address:
warn(f"Patching {total_bytes} bytes at {address:#x} will result in LAST-INSTRUCTION "
f"({curr_ins.address:#x}) being partial overwritten and may cause a crash or break disassembly. "
f"You must use --f to allow misaligned patching.")
f"({curr_ins.address:#x}) being partial overwritten and may cause a crash or "
f"break disassembly. You must use --f to allow misaligned patching.")
if not force_flag:
return

nops = bytearray(nop * total_bytes)
end_address = Address(value=address + total_bytes - 1)
if not end_address.valid:
err(f"Cannot patch instruction at {address:#x}: reaching unmapped area: {end_address:#x}")
err(f"Cannot patch instruction at {address:#x}: reaching unmapped "
f"area: {end_address:#x}")
return

ok(f"Patching {total_bytes} bytes from {address:#x}")
Expand Down

0 comments on commit dafde6a

Please sign in to comment.