*
* Copyright (C) 2009 - 2016 Tom Kistner <tom@duncanthrax.net>
* Copyright (C) 2016 - 2020 Jeremy Harris <jgh@exim.org>
+ * Copyright (c) The Exim Maintainers 2021
*
* http://duncanthrax.net/pdkim/
*
};
-static blob lineending = {.data = US"\r\n", .len = 2};
+static const blob lineending = {.data = US"\r\n", .len = 2};
/* -------------------------------------------------------------------------- */
uschar *
If we have to relax the data for this sig, return our copy of it. */
static blob *
-pdkim_update_ctx_bodyhash(pdkim_bodyhash * b, const blob const * orig_data, blob * relaxed_data)
+pdkim_update_ctx_bodyhash(pdkim_bodyhash * b, const blob * orig_data, blob * relaxed_data)
{
-const blob const * canon_data = orig_data;
+const blob * canon_data = orig_data;
size_t left;
/* Defaults to simple canon (no further treatment necessary) */
/* Make sure we don't exceed the to-be-signed body length */
left = canon_data->len;
if ( b->bodylength >= 0
- && b->signed_body_bytes + left > b->bodylength
+ && left > (unsigned long)b->bodylength - b->signed_body_bytes
)
- left = b->bodylength - b->signed_body_bytes;
+ left = (unsigned long)b->bodylength - b->signed_body_bytes;
if (left > 0)
{
/* VERIFICATION --------------------------------------------------------- */
/* Be careful that the header sig included a bodyash */
- if ( sig->bodyhash.data
+ if (sig->bodyhash.data && sig->bodyhash.len == b->bh.len
&& memcmp(b->bh.data, sig->bodyhash.data, b->bh.len) == 0)
{
DEBUG(D_acl) debug_printf("DKIM [%s] Body hash compared OK\n", sig->domain);