Drop newline in tube.recvline by default#2588
Open
peace-maker wants to merge 7 commits intoGallopsled:devfrom
Open
Drop newline in tube.recvline by default#2588peace-maker wants to merge 7 commits intoGallopsled:devfrom
tube.recvline by default#2588peace-maker wants to merge 7 commits intoGallopsled:devfrom
Conversation
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.
6477a1f to
fa6397c
Compare
Arusekk
reviewed
Jul 1, 2025
Contributor
|
this change makes a lot of sense but the fact that it is breaking really really sucks because exploit.py's are shared through copy-paste rather than a version-locked git repo, so it's impossible to know for which pwntools version a given exploit is intended / will actually work. probably most users aren't going to be aware of this gotcha either :S |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a breaking change!
Change the default value of the
dropparameter toTrueto avoid the commonrecvline().strip()dance and be in line with other readline implementations:Implementations stripping the final newline character when reading a line:
Python's
IOBase.readlinealways 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 likerecvlinesorrecvline_containsalready havedrop=Trueas 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.
Please leave a comment if there are concerns!