diff options
author | Vincent Richard <[email protected]> | 2013-03-24 14:50:16 +0000 |
---|---|---|
committer | Vincent Richard <[email protected]> | 2013-03-24 14:50:16 +0000 |
commit | 32eb1ebe34ae903b91ca0c77d616a07a2ba5afe6 (patch) | |
tree | a152314d07482903577d5e14120367f8358a41ba /src/headerField.cpp | |
parent | Fixed warnings and 64-bit issues. (diff) | |
download | vmime-32eb1ebe34ae903b91ca0c77d616a07a2ba5afe6.tar.gz vmime-32eb1ebe34ae903b91ca0c77d616a07a2ba5afe6.zip |
Strip spaces at end of header lines (Zarafa).
Diffstat (limited to 'src/headerField.cpp')
-rw-r--r-- | src/headerField.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/headerField.cpp b/src/headerField.cpp index 7d23ce84..1d33dac1 100644 --- a/src/headerField.cpp +++ b/src/headerField.cpp @@ -142,7 +142,7 @@ ref <headerField> headerField::parseNext ++pos; const string::size_type contentsStart = pos; - string::size_type contentsEnd = end; + string::size_type contentsEnd = 0; // Extract the field value while (pos < end) @@ -215,6 +215,20 @@ ref <headerField> headerField::parseNext } } + if (pos == end && contentsEnd == 0) + { + // End of data, and no CRLF was found at the end + contentsEnd = end; + } + + // Strip spaces from end of header lines + while (contentsEnd > contentsStart && + (buffer[contentsEnd - 1] == ' ' || buffer[contentsEnd - 1] == '\t' || + buffer[contentsEnd - 1] == '\r' || buffer[contentsEnd - 1] == '\n')) + { + contentsEnd--; + } + // Return a new field ref <headerField> field = headerFieldFactory::getInstance()->create(name); |