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; }