2012-08-01 03:54:19 +02:00
|
|
|
--- server/util_script.c.orig
|
|
|
|
+++ server/util_script.c
|
|
|
|
@@ -415,6 +415,7 @@ AP_DECLARE(int) ap_scan_script_header_er
|
2012-03-20 19:13:21 +01:00
|
|
|
{
|
|
|
|
char x[MAX_STRING_LEN];
|
|
|
|
char *w, *l;
|
|
|
|
+ int wlen;
|
|
|
|
int p;
|
|
|
|
int cgi_status = HTTP_UNSET;
|
|
|
|
apr_table_t *merge;
|
2012-08-01 03:54:19 +02:00
|
|
|
@@ -425,7 +426,14 @@ AP_DECLARE(int) ap_scan_script_header_er
|
2012-03-20 19:13:21 +01:00
|
|
|
if (buffer) {
|
|
|
|
*buffer = '\0';
|
|
|
|
}
|
|
|
|
- w = buffer ? buffer : x;
|
|
|
|
+
|
|
|
|
+ if (r->server->limit_req_fieldsize + 2 > MAX_STRING_LEN) {
|
|
|
|
+ w = apr_palloc(r->pool, r->server->limit_req_fieldsize + 2);
|
|
|
|
+ wlen = r->server->limit_req_fieldsize + 2;
|
|
|
|
+ } else {
|
|
|
|
+ w = buffer ? buffer : x;
|
|
|
|
+ wlen = MAX_STRING_LEN;
|
|
|
|
+ }
|
|
|
|
|
|
|
|
/* temporary place to hold headers to merge in later */
|
|
|
|
merge = apr_table_make(r->pool, 10);
|
2012-08-01 03:54:19 +02:00
|
|
|
@@ -441,7 +449,7 @@ AP_DECLARE(int) ap_scan_script_header_er
|
2012-03-20 19:13:21 +01:00
|
|
|
|
|
|
|
while (1) {
|
|
|
|
|
|
|
|
- int rv = (*getsfunc) (w, MAX_STRING_LEN - 1, getsfunc_data);
|
|
|
|
+ int rv = (*getsfunc) (w, wlen - 1, getsfunc_data);
|
|
|
|
if (rv == 0) {
|
2012-08-01 03:54:19 +02:00
|
|
|
const char *msg = "Premature end of script headers";
|
|
|
|
if (first_header)
|
|
|
|
@@ -553,9 +561,12 @@ AP_DECLARE(int) ap_scan_script_header_er
|
|
|
|
if (!(l = strchr(w, ':'))) {
|
2012-03-20 19:13:21 +01:00
|
|
|
if (!buffer) {
|
|
|
|
/* Soak up all the script output - may save an outright kill */
|
|
|
|
- while ((*getsfunc) (w, MAX_STRING_LEN - 1, getsfunc_data)) {
|
|
|
|
+ while ((*getsfunc) (w, wlen - 1, getsfunc_data)) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
+ } else if (w != buffer) {
|
|
|
|
+ strncpy(buffer, w, MAX_STRING_LEN - 1);
|
|
|
|
+ buffer[MAX_STRING_LEN - 1] = 0;
|
|
|
|
}
|
|
|
|
|
2012-08-01 03:54:19 +02:00
|
|
|
ap_log_rerror(SCRIPT_LOG_MARK, APLOG_ERR|APLOG_TOCLIENT, 0, r,
|