Blame SOURCES/httpd-2.4.34-CVE-2020-11984.patch

9364d6
--- a/modules/proxy/mod_proxy_uwsgi.c	2020/07/24 09:31:46	1880250
9364d6
+++ b/modules/proxy/mod_proxy_uwsgi.c	2020/07/24 09:35:25	1880251
9364d6
@@ -136,7 +136,7 @@
9364d6
     int j;
9364d6
 
9364d6
     apr_size_t headerlen = 4;
9364d6
-    apr_uint16_t pktsize, keylen, vallen;
9364d6
+    apr_size_t pktsize, keylen, vallen;
9364d6
     const char *script_name;
9364d6
     const char *path_info;
9364d6
     const char *auth;
9364d6
@@ -178,6 +178,15 @@
9364d6
         headerlen += 2 + strlen(env[j].key) + 2 + strlen(env[j].val);
9364d6
     }
9364d6
 
9364d6
+    pktsize = headerlen - 4;
9364d6
+    if (pktsize > APR_UINT16_MAX) {
9364d6
+        ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(10259)
9364d6
+                      "can't send headers to %s:%u: packet size too "
9364d6
+                      "large (%" APR_SIZE_T_FMT ")",
9364d6
+                      conn->hostname, conn->port, pktsize);
9364d6
+        return HTTP_INTERNAL_SERVER_ERROR;
9364d6
+    }
9364d6
+
9364d6
     ptr = buf = apr_palloc(r->pool, headerlen);
9364d6
 
9364d6
     ptr += 4;
9364d6
@@ -196,8 +205,6 @@
9364d6
         ptr += vallen;
9364d6
     }
9364d6
 
9364d6
-    pktsize = headerlen - 4;
9364d6
-
9364d6
     buf[0] = 0;
9364d6
     buf[1] = (apr_byte_t) (pktsize & 0xff);
9364d6
     buf[2] = (apr_byte_t) ((pktsize >> 8) & 0xff);