summaryrefslogtreecommitdiff
path: root/modules/proxy/mod_proxy_fcgi.c
diff options
context:
space:
mode:
authorRuediger Pluem <rpluem@apache.org>2023-03-31 14:37:07 +0000
committerRuediger Pluem <rpluem@apache.org>2023-03-31 14:37:07 +0000
commitfd92481223a0d213f1dc2f96745f495efcf33eca (patch)
tree245001fd7721d156b97a20854530f67ae9e640cf /modules/proxy/mod_proxy_fcgi.c
parent9b8cf1746bb004050b02a30bf0222479fbe405c2 (diff)
downloadhttpd-fd92481223a0d213f1dc2f96745f495efcf33eca.tar.gz
Merge r1908827, r1908838 from trunk:
mod_proxy: Check for space/ctrls in nocanon path/urls before forwarding. Follow up to r1908827: CHANGES entry. Submitted by: ylavic Reviewed by: ylavic, rpluem, covener git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1908865 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'modules/proxy/mod_proxy_fcgi.c')
-rw-r--r--modules/proxy/mod_proxy_fcgi.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/modules/proxy/mod_proxy_fcgi.c b/modules/proxy/mod_proxy_fcgi.c
index a422b4e20c..831bd15ae9 100644
--- a/modules/proxy/mod_proxy_fcgi.c
+++ b/modules/proxy/mod_proxy_fcgi.c
@@ -102,9 +102,20 @@ static int proxy_fcgi_canon(request_rec *r, char *url)
path = ap_proxy_canonenc_ex(r->pool, url, strlen(url), enc_path, flags,
r->proxyreq);
+ if (!path) {
+ return HTTP_BAD_REQUEST;
+ }
+ }
+ /*
+ * If we have a raw control character or a ' ' in nocanon path,
+ * correct encoding was missed.
+ */
+ if (path == url && *ap_scan_vchar_obstext(path)) {
+ ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(10414)
+ "To be forwarded path contains control "
+ "characters or spaces");
+ return HTTP_FORBIDDEN;
}
- if (path == NULL)
- return HTTP_BAD_REQUEST;
r->filename = apr_pstrcat(r->pool, "proxy:fcgi://", host, sport, "/",
path, NULL);