You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@trafficserver.apache.org by "bneradt (via GitHub)" <gi...@apache.org> on 2025/09/09 15:56:04 UTC
[PR] Fix pqus marshaling [trafficserver]
bneradt opened a new pull request, #12490:
URL: https://github.com/apache/trafficserver/pull/12490
The pqus scheme marshaling logic used "strlen" which accidentally picked up LogAccess::strlen rather than the intended std strlen. This resulted in padded-counting rather than actual strlen counting, which threw off our buffer counting logic and led to corruption and/or crashing.
The updated ip_allow.test.py reproduced a crash without the LogAccess.cc patch included in this commit. With the LogAccess patch, the test now reproduces the expected scheme.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix pqus marshaling [trafficserver]
Posted by "bneradt (via GitHub)" <gi...@apache.org>.
bneradt commented on code in PR #12490:
URL: https://github.com/apache/trafficserver/pull/12490#discussion_r2334101437
##########
src/proxy/logging/LogAccess.cc:
##########
@@ -1940,17 +1940,9 @@ LogAccess::marshal_client_req_url_scheme(char *buf)
alen = hdrtoken_index_to_length(scheme);
} else {
str = "UNKNOWN";
- alen = strlen(str);
- }
-
- // calculate the padded length only if the actual length
- // is not zero. We don't want the padded length to be zero
- // because marshal_mem should write the DEFAULT_STR to the
- // buffer if str is nil, and we need room for this.
- //
- if (alen) {
- plen = round_strlen(alen + 1); // +1 for trailing 0
+ alen = ::strlen(str);
}
+ plen = round_strlen(alen + 1); // +1 for trailing 0
Review Comment:
* The `::` prefix before strlen is the only real production change.
* I simplified the plen calculation because the preceding logic makes it so that alen is always non-empty. This current plen logic was copied from elsewhere (the method marshaling) and is not applicable here.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix pqus marshaling [trafficserver]
Posted by "bneradt (via GitHub)" <gi...@apache.org>.
bneradt merged PR #12490:
URL: https://github.com/apache/trafficserver/pull/12490
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix pqus marshaling [trafficserver]
Posted by "cmcfarlen (via GitHub)" <gi...@apache.org>.
cmcfarlen commented on PR #12490:
URL: https://github.com/apache/trafficserver/pull/12490#issuecomment-3302966847
Added to milestone 10.1.1 via #12519
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix pqus marshaling [trafficserver]
Posted by "bneradt (via GitHub)" <gi...@apache.org>.
bneradt commented on code in PR #12490:
URL: https://github.com/apache/trafficserver/pull/12490#discussion_r2334257847
##########
src/proxy/logging/LogAccess.cc:
##########
@@ -1940,17 +1940,9 @@ LogAccess::marshal_client_req_url_scheme(char *buf)
alen = hdrtoken_index_to_length(scheme);
} else {
str = "UNKNOWN";
- alen = strlen(str);
- }
-
- // calculate the padded length only if the actual length
- // is not zero. We don't want the padded length to be zero
- // because marshal_mem should write the DEFAULT_STR to the
- // buffer if str is nil, and we need room for this.
- //
- if (alen) {
- plen = round_strlen(alen + 1); // +1 for trailing 0
+ alen = ::strlen(str);
Review Comment:
This is the key change: use `::strlen` instead of what was `LogAccess:strlen`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org