File: parse-arc-leaks.patch

package info (click to toggle)
opendmarc 1.4.2-5.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 9,900 kB
  • sloc: xml: 291,627; ansic: 14,128; perl: 2,384; sh: 460; makefile: 213; python: 58
file content (35 lines) | stat: -rw-r--r-- 1,074 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
From: "@KIC-8462852" <>
Date: Sat, 17 Jun 2023 11:48:36 +0100
Subject: Fix memory leaks when parsing ARC headers

Origin: other, https://github.com/trusteddomainproject/OpenDMARC/files/11602321/opendmarc.patch.txt
Bug: https://github.com/trusteddomainproject/OpenDMARC/issues/241
---
 opendmarc/opendmarc.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/opendmarc/opendmarc.c b/opendmarc/opendmarc.c
index 9317817..e53953e 100644
--- a/opendmarc/opendmarc.c
+++ b/opendmarc/opendmarc.c
@@ -2614,6 +2614,8 @@ mlfi_eom(SMFICTX *ctx)
 		/* parse it */
 		if (opendmarc_arcares_parse(hdr->hdr_value, &aar_hdr_new->arcares) != 0)
 		{
+			free(aar_hdr_new);
+			aar_hdr_new = NULL;
 			syslog(LOG_WARNING,
 			       "%s: ignoring invalid %s header \"%s\"",
 			       dfc->mctx_jobid, hdr->hdr_name, hdr->hdr_value);
@@ -2660,7 +2662,11 @@ mlfi_eom(SMFICTX *ctx)
 
 		/* parse it */
 		if (opendmarc_arcseal_parse(hdr->hdr_value, &as_hdr_new->arcseal) != 0)
+		{
+			free(as_hdr_new);
+			as_hdr_new = NULL;
 			continue;
+		}
 
 		if (dfc->mctx_ashead == NULL)
 		{