Repository navigation
fix out-of-bounds read in mod_proxy_html metafix - #783
arshsmith1 wants to merge 2 commits into
Conversation
|
The fix looks correct. I reproduced both out-of-bounds reads with a real httpd ( Could you add a regression test? There are no mod_proxy_html tests yet. A case with the meta tag at the very end of the body would do, although without ASan or a guard page it may also pass on trunk. |
Serve documents through mod_proxy_html with ProxyHTMLMeta on: a well-formed http-equiv tag is lifted into a response header, and a tag at the very end of the body is handled without reading past it.
|
Added |
|
Thanks for the test. I checked it locally: with a guard page after the mapped file, both cases crash on trunk and pass with the fix. |
metafix scans the backend response buffer for a header name and content value, but buf comes straight from apr_bucket_read and is not NUL terminated while the scans have no bound against buf+len. A backend body whose tag lands at the end of the bucket (with ProxyHTMLMeta on) walks past the buffer, reading adjacent heap and copying it into a response header name. Bound every scan in metafix to buf+len so a tag at the buffer boundary stops cleanly.