Skip to content

Conversation

peace-maker
Copy link
Member

@peace-maker peace-maker commented Jun 19, 2025

This is a breaking change!

Change the default value of the drop parameter to True to avoid the common recvline().strip() dance and be in line with other readline implementations:

Implementations stripping the final newline character when reading a line:

Python's IOBase.readline always includes the trailing newline, except for when there is none on the last line of a file.

My claim is that exploits usually don't care about the trailing newline requiring users to strip it before parsing the line for e.g. address leaks. All other tube.recvline* functions like recvlines or recvline_contains already have drop=True as the default and strip the newline character(s), so this increases the API's consistency.

This will break old exploits that expect the newline in some comparision, but the benefit for newer exploit not having to keep stripping seems to outweight this drawback.

if io.recvline() == b'expected\n': # expected value includes the \n and would break
  ...

line = io.recvline()
return line[:-1] # skip last character

Please leave a comment if there are concerns!

Change the default value of the `drop` parameter to `True` to avoid the common `recvline().strip()` dance and be in line with other readline implementations.
@peace-maker peace-maker force-pushed the recvline_drop_newline branch from 6477a1f to fa6397c Compare June 19, 2025 16:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants