summaryrefslogblamecommitdiffstats
path: root/opendkim-CVE-2022-48521-fix.patch
blob: 3cec20c64943910d8038144e492b475df3708514 (plain) (tree)





























                                                                              
diff --git a/opendkim/opendkim.c b/opendkim/opendkim.c
index 5517322c..494c9157 100644
--- a/opendkim/opendkim.c
+++ b/opendkim/opendkim.c
@@ -13652,8 +13652,15 @@ mlfi_eom(SMFICTX *ctx)
 			return SMFIS_TEMPFAIL;
 		}
 
-		c = 0;
+		c = 1;
+
 		for (hdr = dfc->mctx_hqhead; hdr != NULL; hdr = hdr->hdr_next)
+		{
+			if (strcasecmp(hdr->hdr_hdr, AUTHRESULTSHDR) == 0)
+				c++;
+		}
+
+		for (hdr = dfc->mctx_hqtail; hdr != NULL; hdr = hdr->hdr_prev)
 		{
 			memset(ares, '\0', sizeof(struct authres));
 
@@ -13665,7 +13672,7 @@ mlfi_eom(SMFICTX *ctx)
 				char *slash;
 
 				/* remember index */
-				c++;
+				c--;
 
 				/* parse the header */
 				arstat = ares_parse((u_char *) hdr->hdr_val,