maskit opened a new pull request, #14126: URL: https://github.com/apache/trafficserver/pull/14126
FetchSM read the Content-Length value passed to `ext_add_header` as a C string with `atoll`, ignoring the length it was given. When the value is not NUL-terminated right after its length, digits that follow it in memory become part of the request body length. FetchSM sizes its write to the transaction from that number, so the write never completes and the fetch waits for body bytes that never come. The `Content-Length` header actually sent is unaffected. OCSP stapling always hits this: it formats the request body length into an uninitialized buffer without a terminating NUL. When the bytes after the digits happen to be digits, an OCSP refresh can be reported as failed. One way is a responder that closes the connection: the unfinished write then gets an error that overrides the completed response. Plugins calling `TSFetchHeaderAdd` with an unterminated value are affected the same way. The in-tree Lua and C++ API callers pass NUL-terminated values. The fix parses the value with `mime_parse_int64` within the given length, the same parser HTTP header parsing uses. ## Testing New case in `test_FetchSM.cc`: passes the first two bytes of "697" as the value. It fails without the fix (697 instead of 69) and passes with it, on BoringSSL and OpenSSL 4 builds. -- 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]
