From: Yann Ylavic Date: Fri, 27 Nov 2020 17:31:09 +0000 (+0000) Subject: ap_pbase64decode(): save double NUL byte allocation and assignment. X-Git-Tag: 2.5.0-alpha2-ci-test-only~1120 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6fc9b295a0b5e6e638a0d889a60c0a1aa74678f9;p=thirdparty%2Fapache%2Fhttpd.git ap_pbase64decode(): save double NUL byte allocation and assignment. apr_base64_decode_len() already accounts for the NUL byte, and apr_base64_decode() already NUL terminates the string, no need to do it in ap_pbase64decode(). git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1883872 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/server/util.c b/server/util.c index f829b5668eb..72aa54d31d1 100644 --- a/server/util.c +++ b/server/util.c @@ -2474,11 +2474,9 @@ char *ap_get_local_host(apr_pool_t *a) AP_DECLARE(char *) ap_pbase64decode(apr_pool_t *p, const char *bufcoded) { char *decoded; - int l; - decoded = (char *) apr_palloc(p, 1 + apr_base64_decode_len(bufcoded)); - l = apr_base64_decode(decoded, bufcoded); - decoded[l] = '\0'; /* make binary sequence into string */ + decoded = (char *) apr_palloc(p, apr_base64_decode_len(bufcoded)); + apr_base64_decode(decoded, bufcoded); return decoded; }