Blame SOURCES/httpd-2.4.34-CVE-2021-36160.patch

879b17
diff --git a/modules/proxy/mod_proxy_uwsgi.c b/modules/proxy/mod_proxy_uwsgi.c
879b17
index a4f192f..a678b1d 100644
879b17
--- a/modules/proxy/mod_proxy_uwsgi.c
879b17
+++ b/modules/proxy/mod_proxy_uwsgi.c
879b17
@@ -453,11 +453,8 @@ static int uwsgi_handler(request_rec *r, proxy_worker * worker,
879b17
                          const char *proxyname, apr_port_t proxyport)
879b17
 {
879b17
     int status;
879b17
-    int delta = 0;
879b17
-    int decode_status;
879b17
     proxy_conn_rec *backend = NULL;
879b17
     apr_pool_t *p = r->pool;
879b17
-    size_t w_len;
879b17
     char server_portstr[32];
879b17
     char *u_path_info;
879b17
     apr_uri_t *uri;
879b17
@@ -469,23 +466,14 @@ static int uwsgi_handler(request_rec *r, proxy_worker * worker,
879b17
 
879b17
     uri = apr_palloc(r->pool, sizeof(*uri));
879b17
 
879b17
-    /* ADD PATH_INFO */
879b17
-#if AP_MODULE_MAGIC_AT_LEAST(20111130,0)
879b17
-    w_len = strlen(worker->s->name);
879b17
-#else
879b17
-    w_len = strlen(worker->name);
879b17
-#endif
879b17
-    u_path_info = r->filename + 6 + w_len;
879b17
-    if (u_path_info[0] != '/') {
879b17
-        delta = 1;
879b17
-    }
879b17
-    decode_status = ap_unescape_url(url + w_len - delta);
879b17
-    if (decode_status) {
879b17
+    /* ADD PATH_INFO (unescaped) */
879b17
+    u_path_info = ap_strchr(url + sizeof(UWSGI_SCHEME) + 2, '/');
879b17
+    if (!u_path_info || ap_unescape_url(u_path_info) != OK) {
879b17
         ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(10100)
879b17
-                      "unable to decode uri: %s", url + w_len - delta);
879b17
+                      "unable to decode uwsgi uri: %s", url);
879b17
         return HTTP_INTERNAL_SERVER_ERROR;
879b17
     }
879b17
-    apr_table_add(r->subprocess_env, "PATH_INFO", url + w_len - delta);
879b17
+    apr_table_add(r->subprocess_env, "PATH_INFO", u_path_info);
879b17
 
879b17
 
879b17
     /* Create space for state information */