Mailing List Archive

svn commit: r1882775 - /httpd/httpd/trunk/server/util.c
Author: rpluem
Date: Fri Oct 23 06:23:03 2020
New Revision: 1882775

URL: http://svn.apache.org/viewvc?rev=1882775&view=rev
Log:
* apr_base64_encode_len already includes space for the terminating zero
and apr_base64_encode returns a zero terminated string in encoded.

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

Modified: httpd/httpd/trunk/server/util.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/util.c?rev=1882775&r1=1882774&r2=1882775&view=diff
==============================================================================
--- httpd/httpd/trunk/server/util.c (original)
+++ httpd/httpd/trunk/server/util.c Fri Oct 23 06:23:03 2020
@@ -2558,9 +2558,8 @@ AP_DECLARE(char *) ap_pbase64encode(apr_
char *encoded;
int l = strlen(string);

- encoded = (char *) apr_palloc(p, 1 + apr_base64_encode_len(l));
- l = apr_base64_encode(encoded, string, l);
- encoded[l] = '\0'; /* make binary sequence into string */
+ encoded = (char *) apr_palloc(p, apr_base64_encode_len(l));
+ apr_base64_encode(encoded, string, l);

return encoded;
}