You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by co...@apache.org on 2017/05/27 20:13:49 UTC

svn commit: r1796446 - in /httpd/httpd/trunk: CHANGES server/util.c

Author: covener
Date: Sat May 27 20:13:49 2017
New Revision: 1796446

URL: http://svn.apache.org/viewvc?rev=1796446&view=rev
Log:
PR61124: ap_parse_form_data() EBCDIC fix

URL-decoding doesn't work on EBCDIC.

Submitted By: Hank Ibell <hwibell gmail.com>



Modified:
    httpd/httpd/trunk/CHANGES
    httpd/httpd/trunk/server/util.c

Modified: httpd/httpd/trunk/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=1796446&r1=1796445&r2=1796446&view=diff
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Sat May 27 20:13:49 2017
@@ -1,6 +1,9 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.5.0
 
+  *) core: ap_parse_form_data() URL-decoding doesn't work on EBCDIC
+     platforms. PR61124. [Hank Ibell <hwibell gmail.com>]
+
   *) core: Deprecate ap_get_basic_auth_pw() and add 
      ap_get_basic_auth_components(). 
      [Emmanuel Dreyfus <manu netbsd.org>, Jacob Champion, Eric Covener]

Modified: httpd/httpd/trunk/server/util.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/util.c?rev=1796446&r1=1796445&r2=1796446&view=diff
==============================================================================
--- httpd/httpd/trunk/server/util.c (original)
+++ httpd/httpd/trunk/server/util.c Sat May 27 20:13:49 2017
@@ -2684,8 +2684,7 @@ AP_DECLARE(int) ap_parse_form_data(reque
     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;
 
@@ -2752,30 +2751,13 @@ AP_DECLARE(int) ap_parse_form_data(reque
                     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) {