]>
Commit | Line | Data |
---|---|---|
0e467b1f AM |
1 | |
2 | - use a sensibly % 64 sized buffer | |
3 | - cope with short reads properly | |
4 | - remove redundant variable | |
5 | ||
6 | --- httpd-2.0.46/server/util_md5.c.md5dig | |
7 | +++ httpd-2.0.46/server/util_md5.c | |
8 | @@ -198,16 +198,14 @@ | |
9 | AP_DECLARE(char *) ap_md5digest(apr_pool_t *p, apr_file_t *infile) | |
10 | { | |
11 | apr_md5_ctx_t context; | |
12 | - unsigned char buf[1000]; | |
13 | - long length = 0; | |
14 | - apr_size_t nbytes; | |
15 | + unsigned char buf[4096]; | |
16 | + apr_size_t nbytes = sizeof buf; | |
17 | apr_off_t offset = 0L; | |
18 | ||
19 | apr_md5_init(&context); | |
20 | - nbytes = sizeof(buf); | |
21 | while (apr_file_read(infile, buf, &nbytes) == APR_SUCCESS) { | |
22 | - length += nbytes; | |
23 | apr_md5_update(&context, buf, nbytes); | |
24 | + nbytes = sizeof(buf); | |
25 | } | |
26 | apr_file_seek(infile, APR_SET, &offset); | |
27 | return ap_md5contextTo64(p, &context); |