You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The function FileStructure.struntil returns one byte less for no apparent reason. For example, when I request fp.struntil("flags") I expect to get all 8 bytes of the flags struct.
Tested in the pwntools:stable dockercontainer
pwntools@541d39158471:/$ python
Python 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from pwn import *
>>> context.clear(arch="amd64")
>>> fp = FileStructure()
>>> payload = fp.struntil("flags")
>>> len(payload)
7
-> I only got 7 bytes
Reason
In pwnlib/filepointer.py the last byte gets truncated
def struntil(self,v):
[...]
return structure[:-1]
Proposed fix
Either remove the [:-1] or write it in the documentation why the function is supposed to behave this way.
The text was updated successfully, but these errors were encountered:
The function
FileStructure.struntil
returns one byte less for no apparent reason. For example, when I requestfp.struntil("flags")
I expect to get all 8 bytes of the flags struct.Tested in the pwntools:stable dockercontainer
-> I only got 7 bytes
Reason
In
pwnlib/filepointer.py
the last byte gets truncatedProposed fix
Either remove the
[:-1]
or write it in the documentation why the function is supposed to behave this way.The text was updated successfully, but these errors were encountered: