SABITHSAHEB opened a new pull request, #14136:
URL: https://github.com/apache/trafficserver/pull/14136

   With `--cmcd-nor=true`, `getCmcdNor` takes the `nor=` entry of the client's 
`Cmcd-Request` header as a view into the MIME heap, strips the prefix and 
optional quotes, and percent-decodes the rest into the prefetch path. A request 
carrying `nor=`, `nor="` or `nor=""` leaves that view empty, so `front()` and 
`back()` run on an empty `string_view` and `TSStringPercentDecode` is called 
with a length of 0. The API treats 0 as "the input is NUL-terminated" and falls 
back to `strlen`, but header values are counted and not terminated, so the scan 
runs past the value into neighbouring header strings and stale heap bytes until 
it happens to find a NUL. Up to 8 KB of those bytes are decoded into `relpath` 
and, when `makeSafeRelativeFetchPath` accepts them, sent upstream as a 
background fetch and written to the debug log. I confirmed it by running the 
`getCmcdNor` and `TSStringPercentDecode` logic against an exactly sized heap 
value under ASan, which reports a heap-buffer-overflow read in the
  `strlen` fallback; without ASan, the bytes that follow the value come back as 
the prefetch path. The fix guards `front()`/`back()` and skips the field when 
nothing is left after stripping, so an empty `nor` behaves like an absent one, 
and I kept it in `getCmcdNor` rather than changing the documented zero-length 
meaning of the public `TSStringPercentDecode` API that other plugins may rely 
on.
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to