You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by yl...@apache.org on 2024/07/08 14:25:58 UTC

svn commit: r1919023 - /httpd/httpd/trunk/modules/proxy/proxy_util.c

Author: ylavic
Date: Mon Jul  8 14:25:58 2024
New Revision: 1919023

URL: http://svn.apache.org/viewvc?rev=1919023&view=rev
Log:
mod_proxy: Don't mangle r->filename when ap_proxy_canon_netloc() fails.

ap_proxy_canon_netloc() called from canon_handler hooks modifies its given
url in pace, hence &r->filename[6] passed from ap_proxy_canon_url().

This is not an issue if every canon_handler hook succeeds (or declines)
since r->filename is usually completely rewritten finally, but on failure
it gets truncated.

Avoid this by passing a copy of r->filename from the start, the proxy *url
and r->filename don't need to point to the same data.

* proxy/proxy_util.c(ap_proxy_canon_url):
  Pass a copy of r->filename to the canon_handler hooks.


Modified:
    httpd/httpd/trunk/modules/proxy/proxy_util.c

Modified: httpd/httpd/trunk/modules/proxy/proxy_util.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/proxy_util.c?rev=1919023&r1=1919022&r2=1919023&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/proxy_util.c (original)
+++ httpd/httpd/trunk/modules/proxy/proxy_util.c Mon Jul  8 14:25:58 2024
@@ -2561,7 +2561,7 @@ PROXY_DECLARE(int) ap_proxy_canon_url(re
     }
 
     /* Keep this after fixup_uds_filename() */
-    url = &r->filename[6];
+    url = ap_pstrdup(r->pool, r->filename + 6);
 
     if ((dconf->interpolate_env == 1) && (r->proxyreq == PROXYREQ_REVERSE)) {
         /* create per-request copy of reverse proxy conf,