From eb89e81ddf16f77dae4fd4aee1fda44c8d8306e6 Mon Sep 17 00:00:00 2001 From: Paul Arthur Date: Sat, 2 Nov 2024 17:39:35 +0000 Subject: [PATCH] arc_canon_strip_b: account for FWS around the '=' --- libopenarc/arc-canon.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/libopenarc/arc-canon.c b/libopenarc/arc-canon.c index b0f6326..ccd223c 100644 --- a/libopenarc/arc-canon.c +++ b/libopenarc/arc-canon.c @@ -965,8 +965,10 @@ arc_canon_strip_b(ARC_MESSAGE *msg, char *text) tmp = tmpbuf; end = tmpbuf + sizeof tmpbuf - 1; - /* FIXME: this looks overly simplistic. tag-lists are allowed to - * contain FWS, and headers are allowed to contain CFWS. + /* Strictly speaking this is wrong, RFC 8617 allows CFWS around i= + * and cv= so this code could be confused by interestingly-shaped + * comments, but that part of the syntax is different from all other + * tag-lists so we're going to pretend it says FWS. */ for (p = text; *p != '\0'; p++) { @@ -1004,7 +1006,10 @@ arc_canon_strip_b(ARC_MESSAGE *msg, char *text) tmp = tmpbuf; } - last = *p; + if (!isspace(*p)) + { + last = *p; + } } /* flush anything cached */