Conversation
Signed-off-by: Robert McConnell <robert@mcc0nnell.org>
notroj
suggested changes
Sep 15, 2026
notroj
left a comment
Collaborator
There was a problem hiding this comment.
LGTM apart from the test ordering nit.
| assert r.response["body"] == b"Hello" | ||
|
|
||
| # a trailing empty RemoteIPHeader token must not underflow the trim pointer | ||
| def test_proxy_03_005(self, env): |
Collaborator
There was a problem hiding this comment.
I just noticed this (and the previous test added here) are not in sorted order in this file, can you reorder please?
Collaborator
|
Thank you! |
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.
remoteip_modify_request()trims eachRemoteIPHeadertoken by formingparse_remote + strlen(parse_remote) - 1before checking whether the token isempty. A trailing comma can make the token empty, for example:
In that case the old code forms a pointer one byte before the string object.
ASan invalid-pointer-pair instrumentation catches the old form; the
end-exclusive form in this patch is clean.
Use an end-exclusive pointer and inspect
eos[-1]only aftereos > parse_remote. This keeps the existing literal-space trimming semantics andavoids forming the invalid pointer.
The regression test exercises a trailing empty
RemoteIPHeadertoken throughmod_remoteip.Validation:
git diff --checkmod_remoteipbuilds as a DSO withapxstrailing-empty-token request
detect_invalid_pointer_pairs=2: old primitive reports an invalidpointer pair; new end-exclusive primitive exits cleanly