This is an automated email from the ASF dual-hosted git repository.
cmcfarlen pushed a commit to branch 10.1.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/10.1.x by this push:
new f80f941717 header_rewrite: Fix uninitialized bufp/hdr_loc (#12520)
f80f941717 is described below
commit f80f941717398db39c2b0d8fcb73a546d8612c84
Author: Brian Neradt <[email protected]>
AuthorDate: Wed Sep 17 14:27:58 2025 -0500
header_rewrite: Fix uninitialized bufp/hdr_loc (#12520)
Fix a bug where if RSRC_RESPONSE_STATUS is requested without
RSRC_SERVER_RESPONSE_HEADERS, the bufp and hdr_loc variables would be
uninitialized when passed to TSHttpHdrStatusGet().
This change ensures that TSHttpTxnServerRespGet() is called when
either resource is requested, properly initializing the required
variables.
(cherry picked from commit f792cd70ef87ccefb6acff3ef12a375f11a8e6b9)
---
plugins/header_rewrite/resources.cc | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/plugins/header_rewrite/resources.cc
b/plugins/header_rewrite/resources.cc
index 3f84e0b83f..d54eb7d0ac 100644
--- a/plugins/header_rewrite/resources.cc
+++ b/plugins/header_rewrite/resources.cc
@@ -46,16 +46,16 @@ Resources::gather(const ResourceIDs ids, TSHttpHookID hook)
switch (hook) {
case TS_HTTP_READ_RESPONSE_HDR_HOOK:
// Read response headers from server
- if (ids & RSRC_SERVER_RESPONSE_HEADERS) {
+ if ((ids & RSRC_SERVER_RESPONSE_HEADERS) || (ids & RSRC_RESPONSE_STATUS)) {
Dbg(pi_dbg_ctl, "\tAdding TXN server response header buffers");
if (TSHttpTxnServerRespGet(txnp, &bufp, &hdr_loc) != TS_SUCCESS) {
Dbg(pi_dbg_ctl, "could not gather bufp/hdr_loc for response");
return;
}
- }
- if (ids & RSRC_RESPONSE_STATUS) {
- Dbg(pi_dbg_ctl, "\tAdding TXN server response status resource");
- resp_status = TSHttpHdrStatusGet(bufp, hdr_loc);
+ if (ids & RSRC_RESPONSE_STATUS) {
+ Dbg(pi_dbg_ctl, "\tAdding TXN server response status resource");
+ resp_status = TSHttpHdrStatusGet(bufp, hdr_loc);
+ }
}
break;