From 5979f0ada48e1c3187c937de87b652356050c40c Mon Sep 17 00:00:00 2001 From: Jim Jagielski Date: Tue, 30 May 2017 12:18:18 +0000 Subject: [PATCH] Merge r1796446 from trunk: PR61124: ap_parse_form_data() EBCDIC fix URL-decoding doesn't work on EBCDIC. Submitted By: Hank Ibell Submitted by: covener Reviewed by: covener, rjung, ylavic git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1796849 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES | 3 +++ STATUS | 5 ----- server/util.c | 26 ++++---------------------- 3 files changed, 7 insertions(+), 27 deletions(-) diff --git a/CHANGES b/CHANGES index 80f76f64d9..cd47e34291 100644 --- a/CHANGES +++ b/CHANGES @@ -2,6 +2,9 @@ Changes with Apache 2.4.26 + *) core: ap_parse_form_data() URL-decoding doesn't work on EBCDIC + platforms. PR61124. [Hank Ibell ] + *) ab: enable option processing for setting a custom HTTP method also for non-SSL builds. [Rainer Jung] diff --git a/STATUS b/STATUS index b1f88e0423..b1c98f8155 100644 --- a/STATUS +++ b/STATUS @@ -120,11 +120,6 @@ RELEASE SHOWSTOPPERS: PATCHES ACCEPTED TO BACKPORT FROM TRUNK: [ start all new proposals below, under PATCHES PROPOSED. ] - *) core: ap_parse_form_data() doesn't work on EBCDIC systems. PR61124. - trunk patch: http://svn.apache.org/r1796446 - 2.4.x patch: svn merge -c 1796446 ^/httpd/httpd/trunk . - +1: covener, rjung, ylavic - *) mod_rewrite: allow users to workaround the over-agressive backreference escaping by selecting the characters to escape mod_rewrite: add BNP flag (backrefnoplus) diff --git a/server/util.c b/server/util.c index fba34bde1a..6667ac2e46 100644 --- a/server/util.c +++ b/server/util.c @@ -2666,8 +2666,7 @@ AP_DECLARE(int) ap_parse_form_data(request_rec *r, ap_filter_t *f, ap_form_pair_t *pair = NULL; apr_array_header_t *pairs = apr_array_make(r->pool, 4, sizeof(ap_form_pair_t)); - char hi = 0; - char low = 0; + char escaped_char[2]; *ptr = pairs; @@ -2734,30 +2733,13 @@ AP_DECLARE(int) ap_parse_form_data(request_rec *r, ap_filter_t *f, continue; } if (FORM_PERCENTA == percent) { - if (c >= 'a') { - hi = c - 'a' + 10; - } - else if (c >= 'A') { - hi = c - 'A' + 10; - } - else if (c >= '0') { - hi = c - '0'; - } - hi = hi << 4; + escaped_char[0] = c; percent = FORM_PERCENTB; continue; } if (FORM_PERCENTB == percent) { - if (c >= 'a') { - low = c - 'a' + 10; - } - else if (c >= 'A') { - low = c - 'A' + 10; - } - else if (c >= '0') { - low = c - '0'; - } - c = low | hi; + escaped_char[1] = c; + c = x2c(escaped_char); percent = FORM_NORMAL; } switch (state) { -- 2.40.0