From: Graham Leggett Date: Mon, 29 Jun 2020 17:45:35 +0000 (+0000) Subject: Use a dedicated constant for the base64 sha1 length. X-Git-Tag: 2.5.0-alpha2-ci-test-only~1319 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e8417d72a296d3784df420132a5e33d2fdff818b;p=thirdparty%2Fapache%2Fhttpd.git Use a dedicated constant for the base64 sha1 length. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1879346 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/server/util_etag.c b/server/util_etag.c index eea14e30e20..c0b55b1b8ef 100644 --- a/server/util_etag.c +++ b/server/util_etag.c @@ -29,6 +29,8 @@ #include "http_protocol.h" /* For index_of_response(). Grump. */ #include "http_request.h" +#define SHA1_DIGEST_BASE64_LEN 4*(APR_SHA1_DIGESTSIZE/3) + /* Generate the human-readable hex representation of an apr_uint64_t * (basically a faster version of 'sprintf("%llx")') */ @@ -168,7 +170,7 @@ AP_DECLARE(char *) ap_make_etag_ex(request_rec *r, etag_rec *er) } etag = apr_palloc(r->pool, weak_len + sizeof("\"\"") + - 4*(APR_SHA1_DIGESTSIZE/3) + vlv_len + 4); + SHA1_DIGEST_BASE64_LEN + vlv_len + 4); if (apr_file_seek(fd, APR_CUR, &offset) != APR_SUCCESS) { return "";