You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by do...@apache.org on 2001/11/28 06:00:34 UTC
cvs commit: httpd-2.0/server util_md5.c
dougm 01/11/27 21:00:34
Modified: server util_md5.c
Log:
use apr_pstrndup() instead of apr_pstrdup() to avoid a strlen call in
ap_md5_binary, since we know the length of the string is always
MD5_DIGESTSIZE * 2
Revision Changes Path
1.27 +2 -2 httpd-2.0/server/util_md5.c
Index: util_md5.c
===================================================================
RCS file: /home/cvs/httpd-2.0/server/util_md5.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- util_md5.c 2001/02/16 04:26:48 1.26
+++ util_md5.c 2001/11/28 05:00:34 1.27
@@ -97,7 +97,7 @@
const char *hex = "0123456789abcdef";
apr_md5_ctx_t my_md5;
unsigned char hash[MD5_DIGESTSIZE];
- char *r, result[33];
+ char *r, result[33]; /* (MD5_DIGESTSIZE * 2) + 1 */
int i;
/*
@@ -117,7 +117,7 @@
}
*r = '\0';
- return apr_pstrdup(p, result);
+ return apr_pstrndup(p, result, MD5_DIGESTSIZE*2);
}
AP_DECLARE(char *) ap_md5(apr_pool_t *p, const unsigned char *string)