SABITHSAHEB opened a new pull request, #14131: URL: https://github.com/apache/trafficserver/pull/14131
1. `HttpCompat::lookup_param_in_strlist` scans each `StrList` cell up to a NUL and never looks at `Str::len`. `match_accept_language` and `match_accept_charset` build their per-element parameter lists with `StrList(false)`, so each cell points into the raw Accept-Language / Accept-Charset value in the header heap, which has no terminator. 2. `HttpBodyFactory` feeds the client's Accept-Language and Accept-Charset into those matchers when `proxy.config.body_factory.enable_customizations` is 2. For a value that ends in a bare `q` parameter, e.g. `Accept-Language: en;q`, the lookup runs past the value and parses the bytes that follow it as the q string. The q factor that picks the error page language or charset can then come from a neighbouring string, and a value that ends its allocation is read out of bounds. 3. Every scan now stops at `param->len`. The NUL checks stay, so the copying lists used by `HttpTransactCache` behave exactly as before. Added a test_Hdrs.cc section that passes counted, unterminated values to both matchers. I could not build ATS on this machine, so I ran the old and patched function bodies in a standalone harness. Under ASan the old code reports a heap-buffer-overflow read just past a 4-byte `en;q` value. Without ASan, `fr;q` followed in memory by `=0.5` gave Q=0.5 before the fix and 1.0 after. The existing accept-language and accept-charset tables pass unchanged with the fix. The new section fails on the old code and passes with the fix. I formatted with a local clang-format 21 rather than the pinned 18, and the diff only touches the changed lines. -- 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]
