]> granicus.if.org Git - apache/commitdiff
Merge r1796446 from trunk:
authorJim Jagielski <jim@apache.org>
Tue, 30 May 2017 12:18:18 +0000 (12:18 +0000)
committerJim Jagielski <jim@apache.org>
Tue, 30 May 2017 12:18:18 +0000 (12:18 +0000)
PR61124: ap_parse_form_data() EBCDIC fix

URL-decoding doesn't work on EBCDIC.

Submitted By: Hank Ibell <hwibell gmail.com>

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
STATUS
server/util.c

diff --git a/CHANGES b/CHANGES
index 80f76f64d9b8d1324c51f2493d013128631a5e07..cd47e34291186f238485a058c7c9217afcba4500 100644 (file)
--- 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 <hwibell gmail.com>]
+
   *) ab: enable option processing for setting a custom HTTP method also for
      non-SSL builds.  [Rainer Jung]
 
diff --git a/STATUS b/STATUS
index b1f88e0423361ed038c22ac4c44e97f11a5a7d7a..b1c98f8155124c687f70eccd62e70ac6d795860d 100644 (file)
--- 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)
index fba34bde1a9b318681fca6a3a9d455e4745359f7..6667ac2e46394e23617eb25ed8dd8410fa9e05d2 100644 (file)
@@ -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) {