Blame SOURCES/httpd-2.4.37-CVE-2022-22719.patch
|
|
17bfed |
--- a/modules/lua/lua_request.c 2022/03/07 14:48:54 1898693
|
|
|
17bfed |
+++ b/modules/lua/lua_request.c 2022/03/07 14:51:19 1898694
|
|
|
17bfed |
@@ -235,14 +235,16 @@
|
|
|
17bfed |
{
|
|
|
17bfed |
int rc = OK;
|
|
|
17bfed |
|
|
|
17bfed |
+ *rbuf = NULL;
|
|
|
17bfed |
+ *size = 0;
|
|
|
17bfed |
+
|
|
|
17bfed |
if ((rc = ap_setup_client_block(r, REQUEST_CHUNKED_ERROR))) {
|
|
|
17bfed |
return (rc);
|
|
|
17bfed |
}
|
|
|
17bfed |
if (ap_should_client_block(r)) {
|
|
|
17bfed |
|
|
|
17bfed |
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
|
|
17bfed |
- char argsbuffer[HUGE_STRING_LEN];
|
|
|
17bfed |
- apr_off_t rsize, len_read, rpos = 0;
|
|
|
17bfed |
+ apr_off_t len_read, rpos = 0;
|
|
|
17bfed |
apr_off_t length = r->remaining;
|
|
|
17bfed |
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
|
|
17bfed |
|
|
|
17bfed |
@@ -250,18 +252,18 @@
|
|
|
17bfed |
return APR_EINCOMPLETE; /* Only room for incomplete data chunk :( */
|
|
|
17bfed |
}
|
|
|
17bfed |
*rbuf = (const char *) apr_pcalloc(r->pool, (apr_size_t) (length + 1));
|
|
|
17bfed |
- *size = length;
|
|
|
17bfed |
- while ((len_read = ap_get_client_block(r, argsbuffer, sizeof(argsbuffer))) > 0) {
|
|
|
17bfed |
- if ((rpos + len_read) > length) {
|
|
|
17bfed |
- rsize = length - rpos;
|
|
|
17bfed |
- }
|
|
|
17bfed |
- else {
|
|
|
17bfed |
- rsize = len_read;
|
|
|
17bfed |
- }
|
|
|
17bfed |
-
|
|
|
17bfed |
- memcpy((char *) *rbuf + rpos, argsbuffer, (size_t) rsize);
|
|
|
17bfed |
- rpos += rsize;
|
|
|
17bfed |
+ while ((rpos < length)
|
|
|
17bfed |
+ && (len_read = ap_get_client_block(r, (char *) *rbuf + rpos,
|
|
|
17bfed |
+ length - rpos)) > 0) {
|
|
|
17bfed |
+ rpos += len_read;
|
|
|
17bfed |
}
|
|
|
17bfed |
+ if (len_read < 0) {
|
|
|
17bfed |
+ return APR_EINCOMPLETE;
|
|
|
17bfed |
+ }
|
|
|
17bfed |
+ *size = rpos;
|
|
|
17bfed |
+ }
|
|
|
17bfed |
+ else {
|
|
|
17bfed |
+ rc = DONE;
|
|
|
17bfed |
}
|
|
|
17bfed |
|
|
|
17bfed |
return (rc);
|
|
|
17bfed |
@@ -278,6 +280,8 @@
|
|
|
17bfed |
{
|
|
|
17bfed |
apr_status_t rc = OK;
|
|
|
17bfed |
|
|
|
17bfed |
+ *size = 0;
|
|
|
17bfed |
+
|
|
|
17bfed |
if ((rc = ap_setup_client_block(r, REQUEST_CHUNKED_ERROR)))
|
|
|
17bfed |
return rc;
|
|
|
17bfed |
if (ap_should_client_block(r)) {
|
|
|
17bfed |
@@ -303,6 +307,9 @@
|
|
|
17bfed |
rpos += rsize;
|
|
|
17bfed |
}
|
|
|
17bfed |
}
|
|
|
17bfed |
+ else {
|
|
|
17bfed |
+ rc = DONE;
|
|
|
17bfed |
+ }
|
|
|
17bfed |
|
|
|
17bfed |
return rc;
|
|
|
17bfed |
}
|