From 7e50ebb715054465143f1244295977dbfe778908 Mon Sep 17 00:00:00 2001 From: trawick Date: Wed, 24 May 2000 17:19:10 +0000 Subject: EBCDIC: Fail the setup of EBCDIC translation tables in sha1 and base64 code if the translation handle passed in is not for a single-byte translation. git-svn-id: http://svn.apache.org/repos/asf/apr/apr-util/trunk@57803 13f79535-47bb-0310-9956-ffa450edef68 --- encoding/ap_base64.c | 17 +++++++++++++++++ encoding/apr_base64.c | 17 +++++++++++++++++ 2 files changed, 34 insertions(+) (limited to 'encoding') diff --git a/encoding/ap_base64.c b/encoding/ap_base64.c index 63394669..b68f5cd9 100644 --- a/encoding/ap_base64.c +++ b/encoding/ap_base64.c @@ -120,7 +120,24 @@ API_EXPORT(ap_status_t) ap_base64init_ebcdic(ap_xlate_t *to_ascii, int i; ap_size_t inbytes_left, outbytes_left; ap_status_t rv; + int onoff; + /* Only single-byte conversion is supported. + */ + rv = ap_xlate_get_sb(to_ascii, &onoff); + if (rv) { + return rv; + } + if (!onoff) { /* If conversion is not single-byte-only */ + return APR_EINVAL; + } + rv = ap_xlate_get_sb(to_ebcdic, &onoff); + if (rv) { + return rv; + } + if (!onoff) { /* If conversion is not single-byte-only */ + return APR_EINVAL; + } xlate_to_ebcdic = to_ebcdic; for (i = 0; i < sizeof(os_toascii); i++) { os_toascii[i] = i; diff --git a/encoding/apr_base64.c b/encoding/apr_base64.c index 63394669..b68f5cd9 100644 --- a/encoding/apr_base64.c +++ b/encoding/apr_base64.c @@ -120,7 +120,24 @@ API_EXPORT(ap_status_t) ap_base64init_ebcdic(ap_xlate_t *to_ascii, int i; ap_size_t inbytes_left, outbytes_left; ap_status_t rv; + int onoff; + /* Only single-byte conversion is supported. + */ + rv = ap_xlate_get_sb(to_ascii, &onoff); + if (rv) { + return rv; + } + if (!onoff) { /* If conversion is not single-byte-only */ + return APR_EINVAL; + } + rv = ap_xlate_get_sb(to_ebcdic, &onoff); + if (rv) { + return rv; + } + if (!onoff) { /* If conversion is not single-byte-only */ + return APR_EINVAL; + } xlate_to_ebcdic = to_ebcdic; for (i = 0; i < sizeof(os_toascii); i++) { os_toascii[i] = i; -- cgit v1.2.1