From: Eric Covener Date: Sat, 27 May 2017 20:13:49 +0000 (+0000) Subject: PR61124: ap_parse_form_data() EBCDIC fix X-Git-Tag: 2.5.0-alpha~398 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a185f0392f6789a9b1bbef2d459117cede62e83e;p=apache PR61124: ap_parse_form_data() EBCDIC fix URL-decoding doesn't work on EBCDIC. Submitted By: Hank Ibell git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1796446 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index 9d8833f4f4..8fe3984b9d 100644 --- a/CHANGES +++ b/CHANGES @@ -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 ] + *) core: Deprecate ap_get_basic_auth_pw() and add ap_get_basic_auth_components(). [Emmanuel Dreyfus , Jacob Champion, Eric Covener] diff --git a/server/util.c b/server/util.c index 5130a7b28a..06d3c97076 100644 --- a/server/util.c +++ b/server/util.c @@ -2684,8 +2684,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; @@ -2752,30 +2751,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) {