From eb5b3b3ec7820a66e3bd92a2a60792da22e50c4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois?= Date: Sun, 17 Sep 2023 18:36:25 +0200 Subject: [PATCH] fix no space after token in MIME header --- src/cpp/Attachment.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/cpp/Attachment.cpp b/src/cpp/Attachment.cpp index 4556162..d8db6c2 100644 --- a/src/cpp/Attachment.cpp +++ b/src/cpp/Attachment.cpp @@ -330,8 +330,10 @@ Attachment::readMime (ifstream &mbox, streamoff &curPos) { lastVar = line.substr (0, colonPos); toLower (lastVar); LOG ("find var: " << lastVar); - // XXX check in RFC if " " after ": " (=> +2 or +1) - string val (cleanString (line.length () >= colonPos+2 ? line.substr (colonPos+2) : "")); + ++colonPos; + if (line.length () >= colonPos && line [colonPos] == ' ') + ++colonPos; + string val (cleanString (line.length () >= colonPos ? line.substr (colonPos) : "")); LOG ("new var: <" << lastVar << " <=> " << val << ">"); env [lastVar] = val; }