Blob Blame History Raw
commit 783f4475291c9c2393e37ead83947dcad4706982
Author: Murray S. Kucherawy <msk@trusteddomain.org>
Date:   Mon Sep 17 10:37:34 2018 -0700

    Fix issue #100: Correct application of sendmail's "no lead space"
    flag when adding seal header fields.  Reported by Matt Domsch.

diff --git a/RELEASE_NOTES b/RELEASE_NOTES
index e2154a6..7889af4 100644
--- a/RELEASE_NOTES
+++ b/RELEASE_NOTES
@@ -4,11 +4,13 @@ This listing shows the versions of the OpenARC package, the date of
 release, and a summary of the changes in that release.
 
 0.1.1		2018/??/??
-	Add FinalReceiver configuration option. When enabled, this filter will
-		append "arc.chain=dom(n)...dom(1)" custody chain data to the A-R field.
+	Add FinalReceiver configuration option.
 	Fix issue #47: Fix syntax of ARC-Authentication-Results with respect
 		to semicolons.  Problem noted by Matt Domsch; based on a
 		patch from Ben Arblaster.
+	Fix issue #100: Correct application of sendmail's "no lead space"
+		flag when adding seal header fields.  Reported by Matt
+		Domsch.
 
 0.1.0		2017/12/06
 	Initial pre-release.
diff --git a/openarc/openarc.c b/openarc/openarc.c
index ca6107d..bc5dee3 100644
--- a/openarc/openarc.c
+++ b/openarc/openarc.c
@@ -3666,22 +3666,26 @@ mlfi_eom(SMFICTX *ctx)
 		     sealhdr = arc_hdr_next(sealhdr))
 		{
 			size_t len;
-			u_char *hfptr;
-			u_char *hfdest;
+			u_char *hfvdest;
 			u_char hfname[BUFRSZ + 1];
+			u_char hfvalue[BUFRSZ + 1];
 
-			hfptr = arc_hdr_name(sealhdr, &len);
-			hfdest = hfname;
 			memset(hfname, '\0', sizeof hfname);
+			strlcpy(hfname, arc_hdr_name(sealhdr, &len),
+			        sizeof hfname);
+			hfname[len] = '\0';
+
+			hfvdest = hfvalue;
+			memset(hfvalue, '\0', sizeof hfvalue);
 			if (cc->cctx_noleadspc)
 			{
-				hfname[0] = ' ';
-				hfdest++;
+				hfvalue[0] = ' ';
+				hfvdest++;
 			}
-			strncpy(hfdest, hfptr, len);
+			strlcat(hfvalue, arc_hdr_value(sealhdr),
+			        sizeof hfvalue);
 
-			status = arcf_insheader(ctx, 1, hfname,
-			                        arc_hdr_value(sealhdr));
+			status = arcf_insheader(ctx, 1, hfname, hfvalue);
 			if (status == MI_FAILURE)
 			{
 				if (conf->conf_dolog)