Skip to content

Commit

Permalink
Merge 5e1e670 into 7d1dae1
Browse files Browse the repository at this point in the history
  • Loading branch information
p0ise committed Oct 6, 2022
2 parents 7d1dae1 + 5e1e670 commit 6e9630d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,12 @@ The table below shows which release corresponds to each branch, and what date th
- [#2062][2062] make pwn cyclic -l work with entry larger than 4 bytes
- [#2092][2092] shellcraft: dup() is now called dupio() consistently across all supported arches
- [#2093][2093] setresuid() in shellcraft uses current euid by default
- [#2116][2116] fix format string badbytes not working

[2062]: https://github.com/Gallopsled/pwntools/pull/2062
[2092]: https://github.com/Gallopsled/pwntools/pull/2092
[2093]: https://github.com/Gallopsled/pwntools/pull/2093
[2116]: https://github.com/Gallopsled/pwntools/pull/2116

## 4.9.0 (`beta`)

Expand Down
4 changes: 2 additions & 2 deletions pwnlib/fmtstr.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,11 +300,11 @@ def make_atoms_simple(address, data, badbytes=frozenset()):
out = []
while i < len(data):
candidate = AtomWrite(address + i, 1, data[i])
while i + candidate.size < len(data) and any(x in badbytes for x in pack(candidate.end)):
while candidate.end < len(data) and any(x in badbytes for x in pack(candidate.end)):
candidate = candidate.union(AtomWrite(candidate.end, 1, data[i + candidate.size]))

sz = min([s for s in SPECIFIER if s >= candidate.size] + [float("inf")])
if i + sz >= len(data):
if i + sz > len(data):
raise RuntimeError("impossible to avoid badbytes starting after offset %d (address %x)" % (i, i + address))
i += candidate.size
candidate = candidate.union(AtomWrite(candidate.end, sz - candidate.size, 0, 0))
Expand Down

0 comments on commit 6e9630d

Please sign in to comment.