CVE-2020-28025: Heap out-of-bounds read in pdkim_finish_bodyhash()
[exim.git] / src / src / pdkim / pdkim.c
index 0ad4d12d8171288b0d085bcea8b386e8add4d1f3..074106b5da11f4c02db4e2df8fc1cedd9bd514a3 100644 (file)
@@ -825,7 +825,7 @@ for (pdkim_signature * sig = ctx->sig; sig; sig = sig->next)
   /* 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);