From 3c0ca91dfb1a811b1a278c4fb63e8e927ebbf547 Mon Sep 17 00:00:00 2001 From: Nic Boet Date: Sun, 13 Nov 2022 19:50:08 -0600 Subject: [PATCH 1/2] fix header canonicalizating eol wrap https://www.rfc-editor.org/rfc/rfc8617#section-4.1.3 https://www.rfc-editor.org/rfc/rfc6376#section-3.4.2 EOL termination states single WSP when canonicalizating header fields using tab x09 or space x20, not both X-Amavis-Alert: BAD HEADER SECTION, Improper folded header field made up entirely of whitespace (char 09 20 hex): ARC-Message-Signature: Signed-off-by: Nic Boet --- libopenarc/arc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libopenarc/arc.c b/libopenarc/arc.c index 1c6c9ded..6b9fbe87 100644 --- a/libopenarc/arc.c +++ b/libopenarc/arc.c @@ -671,8 +671,8 @@ arc_getamshdr_d(ARC_MESSAGE *msg, size_t initial, u_char **buf, size_t *buflen, ':'); len += 1; arc_dstring_catn(msg->arc_hdrbuf, - (u_char *) "\n\t ", - 3); + (u_char *) "\n ", + 2); len = 9; arc_dstring_catn(msg->arc_hdrbuf, (u_char *) tmp, @@ -719,8 +719,8 @@ arc_getamshdr_d(ARC_MESSAGE *msg, size_t initial, u_char **buf, size_t *buflen, if (msg->arc_margin - len == 0) { arc_dstring_catn(msg->arc_hdrbuf, - (u_char *) "\n\t ", - 3); + (u_char *) "\n ", + 2); len = 9; } From 66ca748ae83a3eba5ceec1f76e9d8c742a3cdb6e Mon Sep 17 00:00:00 2001 From: Nic Boet Date: Mon, 14 Nov 2022 00:14:39 -0600 Subject: [PATCH 2/2] adjust len as we are setting one less char now Signed-off-by: Nic Boet --- libopenarc/arc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libopenarc/arc.c b/libopenarc/arc.c index 6b9fbe87..88863a15 100644 --- a/libopenarc/arc.c +++ b/libopenarc/arc.c @@ -673,7 +673,7 @@ arc_getamshdr_d(ARC_MESSAGE *msg, size_t initial, u_char **buf, size_t *buflen, arc_dstring_catn(msg->arc_hdrbuf, (u_char *) "\n ", 2); - len = 9; + len = 8; arc_dstring_catn(msg->arc_hdrbuf, (u_char *) tmp, tmplen); @@ -721,7 +721,7 @@ arc_getamshdr_d(ARC_MESSAGE *msg, size_t initial, u_char **buf, size_t *buflen, arc_dstring_catn(msg->arc_hdrbuf, (u_char *) "\n ", 2); - len = 9; + len = 8; } n = MIN(msg->arc_margin - len,