summaryrefslogtreecommitdiffstats
path: root/server/util_md5.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-25 04:41:27 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-25 04:41:27 +0000
commitc54018b07a9085c0a3aedbc2bd01a85a3b3e20cf (patch)
treef6e1d6fcf9f6db3794c418b2f89ecf9e08ff41c8 /server/util_md5.c
parentAdding debian version 2.4.38-3+deb10u10. (diff)
downloadapache2-c54018b07a9085c0a3aedbc2bd01a85a3b3e20cf.tar.xz
apache2-c54018b07a9085c0a3aedbc2bd01a85a3b3e20cf.zip
Merging upstream version 2.4.59.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'server/util_md5.c')
-rw-r--r--server/util_md5.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/server/util_md5.c b/server/util_md5.c
index 148c60c..bba3b88 100644
--- a/server/util_md5.c
+++ b/server/util_md5.c
@@ -54,7 +54,7 @@ AP_DECLARE(char *) ap_md5_binary(apr_pool_t *p, const unsigned char *buf, int le
{
apr_md5_ctx_t my_md5;
unsigned char hash[APR_MD5_DIGESTSIZE];
- char result[2 * APR_MD5_DIGESTSIZE + 1];
+ char *result;
/*
* Take the MD5 hash of the string argument.
@@ -67,9 +67,9 @@ AP_DECLARE(char *) ap_md5_binary(apr_pool_t *p, const unsigned char *buf, int le
apr_md5_update(&my_md5, buf, (unsigned int)length);
apr_md5_final(hash, &my_md5);
- ap_bin2hex(hash, APR_MD5_DIGESTSIZE, result);
-
- return apr_pstrndup(p, result, APR_MD5_DIGESTSIZE*2);
+ result = apr_palloc(p, 2 * APR_MD5_DIGESTSIZE + 1);
+ ap_bin2hex(hash, APR_MD5_DIGESTSIZE, result); /* sets final '\0' */
+ return result;
}
AP_DECLARE(char *) ap_md5(apr_pool_t *p, const unsigned char *string)